From 8ec8d16b06ff16d1c6430de2faec4cbc38c717cd Mon Sep 17 00:00:00 2001 From: Ben Hamlin Date: Fri, 30 Mar 2018 19:19:29 -0700 Subject: [PATCH] including polyfills in production build (#562) --- packages/razzle/config/createConfig.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/razzle/config/createConfig.js b/packages/razzle/config/createConfig.js index 3ae6dc1f8..9655524cb 100644 --- a/packages/razzle/config/createConfig.js +++ b/packages/razzle/config/createConfig.js @@ -434,9 +434,15 @@ module.exports = ( // runtimeChunk: true, }; } else { - // Specify production entry point (just /client/index.js) + // Specify production entry point (/client/index.js) config.entry = { - client: [paths.appClientIndexJs], + client: [ + // We ship a few polyfills by default but only include them if React is being placed in + // the default path. If you are doing some vendor bundling, you'll need to require the razzle/polyfills + // on your own. + !!dotenv.raw.REACT_BUNDLE_PATH && require.resolve('./polyfills'), + paths.appClientIndexJs + ], }; // Specify the client output directory and paths. Notice that we have