Skip to content

Commit

Permalink
Fix hanging start
Browse files Browse the repository at this point in the history
CRA 3 opts-in to a new webpack 5 feature early to save memory: `futureEmitAssets`
facebook#6696
This optimization only stores the file sizes during webpack compilation, no longer storing the original source
webpack/webpack#8642
This is incompatible with our webpack-dev-server customization setting of `writeToDisk`
webpack/webpack#8642 (comment)
which tries to read the source after emit, which throws an exception, but that error is swallowed and the `npm start` just hangs.
Before we update to webpack 5, where this feature will be the default, we need to stop writing to disk, or find another way to do it than the `writeToDisk` flag.
  • Loading branch information
redbugz committed Apr 27, 2019
1 parent 05940c1 commit 46c8d94
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ module.exports = function(webpackEnv) {
? 'static/js/[name].[contenthash:8].js'
: isEnvDevelopment && 'static/js/bundle.js',
// TODO: remove this when upgrading to webpack 5
futureEmitAssets: true,
// FS - writeToDisk and futureEmitAssets are not compatible, so defaulting back to false: https://github.com/webpack/webpack/pull/8642#issuecomment-455342804
futureEmitAssets: false,
// There are also additional JS chunk files if you use code splitting.
chunkFilename: isEnvProduction
? 'static/js/[name].[contenthash:8].chunk.js'
Expand Down

2 comments on commit 46c8d94

@redbugz
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joeycozza @tylergraf
We will need to stop writing to disk or find a new way to write to disk before we move to webpack 5

@tylergraf
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Please sign in to comment.