Skip to content

Commit e89f153

Browse files
authored
Don't use webpack multi entry unnecessarily (facebook#8834)
Passing an array with a single entry is not equivalent. This causes Webpack to generate another wrapper module around the entry. This is just unnecessary overhead and bytes.
1 parent a4fa63f commit e89f153

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react-scripts/config/webpack.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ module.exports = function(webpackEnv) {
157157
: isEnvDevelopment && 'cheap-module-source-map',
158158
// These are the "entry points" to our application.
159159
// This means they will be the "root" imports that are included in JS bundle.
160-
entry: [
160+
entry: isEnvDevelopment && !shouldUseReactRefresh ? [
161161
// Include an alternative client for WebpackDevServer. A client's job is to
162162
// connect to WebpackDevServer by a socket and get notified about changes.
163163
// When you save a file, the client will either apply hot updates (in case
@@ -172,13 +172,13 @@ module.exports = function(webpackEnv) {
172172
//
173173
// When using the experimental react-refresh integration,
174174
// the webpack plugin takes care of injecting the dev client for us.
175-
isEnvDevelopment && !shouldUseReactRefresh && webpackDevClientEntry,
175+
webpackDevClientEntry,
176176
// Finally, this is your app's code:
177177
paths.appIndexJs,
178178
// We include the app code last so that if there is a runtime error during
179179
// initialization, it doesn't blow up the WebpackDevServer client, and
180180
// changing JS code would still trigger a refresh.
181-
].filter(Boolean),
181+
] : paths.appIndexJs,
182182
output: {
183183
// The build folder.
184184
path: isEnvProduction ? paths.appBuild : undefined,

0 commit comments

Comments
 (0)