Skip to content

Commit 8ec8d16

Browse files
Ben Hamlinjaredpalmer
authored andcommitted
including polyfills in production build (#562)
1 parent e0b645d commit 8ec8d16

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/razzle/config/createConfig.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,15 @@ module.exports = (
434434
// runtimeChunk: true,
435435
};
436436
} else {
437-
// Specify production entry point (just /client/index.js)
437+
// Specify production entry point (/client/index.js)
438438
config.entry = {
439-
client: [paths.appClientIndexJs],
439+
client: [
440+
// We ship a few polyfills by default but only include them if React is being placed in
441+
// the default path. If you are doing some vendor bundling, you'll need to require the razzle/polyfills
442+
// on your own.
443+
!!dotenv.raw.REACT_BUNDLE_PATH && require.resolve('./polyfills'),
444+
paths.appClientIndexJs
445+
],
440446
};
441447

442448
// Specify the client output directory and paths. Notice that we have

0 commit comments

Comments
 (0)