Skip to content

Crash with multiple targets #10917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Timmmm opened this issue May 19, 2020 · 6 comments
Closed

Crash with multiple targets #10917

Timmmm opened this issue May 19, 2020 · 6 comments
Labels

Comments

@Timmmm
Copy link

Timmmm commented May 19, 2020

I have a webpack.config.js with multiple targets as described here, for building a bundle for electron-main and electron-renderer. The final export is:

module.exports = [mainConfig, rendererConfig];

If I set it to either config individually, e.g.

module.exports = mainConfig;

then it works perfectly. The output is generated in the correct directory, and Webpack prints some stats at the end.

However if I export both configs in an array, then Webpack seems to crash! This is the full output I get:

$ node_modules/.bin/webpack-cli 
Starting type checking service...
$

As far as I can tell it generates the output for rendererConfig, and then just immediately exits without generating mainConfig, or printing any stats. It always generates rendererConfig irrespective of the order (I guess because they are run in parallel?).

I don't have a minimal reproducer yet, because honestly that would be a ton of work, and it might be a lot easier if there were some way to get Webpack to actually output some logs, but I've tried a ton of things - I even read the source code - and it doesn't seem to have any way to output debug logs at all! --verbose does nothing. stats: 'verbose' is useless because it crashes before printing stats. The only thing that seems to print anything at all before it crashes is --progress, which gets up to 97% normally but doesn't print any useful errors:

$ node_modules/.bin/webpack-cli --progress
Starting type checking service...
97% [0] $ 

How can I debug this?

webpack version: 4.43.0
webpack-cli version: 3.3.11
Node.js version: 14.0.0
Operating System: MacOS 10.14.6

@sokra
Copy link
Member

sokra commented May 19, 2020

Difficult to see what the problem is here.

You could try --progress --profile and check the output. Also try to removing plugins.

@Timmmm
Copy link
Author

Timmmm commented May 19, 2020

That got a little more info:

$ node_modules/.bin/webpack-cli --progress --profile
Starting type checking service...
<i> [webpack.Progress] 14ms [0] building
<i> [webpack.Progress] 92ms [1] building
<i> [webpack.Progress] 111ms [0] building
<i> [webpack.Progress] 16ms [1] building
<i> [webpack.Progress] 28ms [0] building
<i> [webpack.Progress] 38ms [1] building
<i> [webpack.Progress] 85ms [1] after chunk asset optimization
<w> [webpack.Progress] 10551ms [0] building
<i> [webpack.Progress] 35ms [0] finish module graph
<i> [webpack.Progress] 44ms [0] chunk graph
<i> [webpack.Progress] 24ms [0] advanced chunk optimization
<i> [webpack.Progress] 24ms [0] before module ids
<i> [webpack.Progress] 65ms [0] hashing
<i> [webpack.Progress] 127ms [0] chunk assets processing
<w> [webpack.Progress] 2127ms [0] after chunk asset optimization
<i> [webpack.Progress] 194ms [0] emitting
97% [0] $

I'll try removing some plugins.

@Timmmm
Copy link
Author

Timmmm commented May 19, 2020

Ah I got lucky - the issue is caused by ForkTsCheckerWebpackPlugin. I guess that makes sense - from the name it sounds like it might use fork() (hopefully not!), but either way it is presumably starting extra processes and that must not work well with whatever Webpack does for multiple targets.

I'll try to make a small repro with just that plugin (but I might just ditch it and use ts-loader for type checking).

@sokra
Copy link
Member

sokra commented May 20, 2020

@johnnyreilly @piotr-oles

@piotr-oles
Copy link

@Timmmm Could you close this issue and re-create it on the ForkTsCheckerWebpackPlugin issues?

I'm currently working on the rewrite of this plugin and better support for multiple targets is on the list to improve. It would be really nice if you could create a reproduction repository.

@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

It's subject to automatic issue closing if there is no activity in the next 15 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants