electron-userland / electron-userland/electron-webpack

Eslint Warnings prevent dev-runner from starting electron

Open
#55 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
902
Forks
168
PR merge metrics
No merged PRs in 30d

Description

Thanks for this awesome utility!
...

If eslint throws a warning or error on initial start up electron wont be started until after the dev process is killed.

I am not sure exactly what is happening but I managed to get around it by moving some code around in src/dev/dev-runner. DevRunner::start (its the compiled version)
This has the side effect of opening electron before the renderer process has generated the assets.

```
start() {
var _this = this

return (0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () {
const wdsHost = 'localhost'
const wdsPort = yield (0, (_util || _load_util()).getFreePort)(wdsHost, 9080)
const env = Object.assign({}, (0, (_devUtil || _load_devUtil()).getCommonEnv)(), {
ELECTRON_WEBPACK_WDS_HOST: wdsHost,
ELECTRON_WEBPACK_WDS_PORT: wdsPort
})
const hmrServer = new (_HmrServer || _load_HmrServer()).HmrServer()

yield (_bluebirdLst2 || _load_bluebirdLst2()).default.all([ (0, (_WebpackDevServerManager || _load_WebpackDevServerManager()).startRenderer)(projectDir, env), hmrServer.listen().then(function(it) {
socketPath = it
}), emptyMainOutput().then(function() {
return _this.startMainCompilation(hmrServer).then(function() {
return (_util || _load_util()).getFreePort('127.0.0.1', 5858)
}).then(function(inspect) {
const electronArgs = process.env.ELECTRON_ARGS
const args = electronArgs != null && electronArgs.length > 0 ? JSON.parse(electronArgs) : [ `--inspect=${inspect}` ]
args.push(_path.join(projectDir, 'dist/main/main.js'))
// we should start only when both start and main are started
startElectron(args, env)
})
}) ])
hmrServer.ipc.on('error', function(error) {
(0, (_devUtil || _load_devUtil()).logError)('Main', error)
})

})()
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/dev/dev-runner and compare it with the compiled DevRunner::start shown in the issue. Reproduce a development start with an ESLint warning or error, then verify that Electron starts only after the renderer assets are generated and the main process is ready.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript, webpack
Domain
build-system, desktop-dev, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.