From ab8d25dec2fa5b92b0adbe219d23810777c24b1f Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 14 Nov 2019 13:50:51 -0600 Subject: [PATCH] make sure the donate-button-v2.js never splits and include the runtimeChunk --- ...onate-button.v2.js => donate-button-v2.js} | 0 config/webpack/production.js | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) rename app/javascript/packs/{donate-button.v2.js => donate-button-v2.js} (100%) diff --git a/app/javascript/packs/donate-button.v2.js b/app/javascript/packs/donate-button-v2.js similarity index 100% rename from app/javascript/packs/donate-button.v2.js rename to app/javascript/packs/donate-button-v2.js diff --git a/config/webpack/production.js b/config/webpack/production.js index 44c688c4..24c11951 100644 --- a/config/webpack/production.js +++ b/config/webpack/production.js @@ -1,5 +1,22 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production' const environment = require('./environment') -environment.splitChunks() +environment.splitChunks((config) => { + const excludeDonateButtonFromSplit = { + optimization: + { + splitChunks: + { + chunks(chunk) { + // donate-button-v2 can never be split. So don't + return chunk.name !== 'donate-button-v2' + } + }, + // we can't have the donate-button-v2 ONLY include runtimeChunk + // so we never split it out. 🙁 + runtimeChunk: false + }, + } + return Object.assign({}, config, excludeDonateButtonFromSplit) +}) module.exports = environment.toWebpackConfig()