From d826ee9ee9ee7451b443ac80a5307f6afa019ae6 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Mon, 8 Apr 2019 17:53:06 -0400 Subject: [PATCH] Add a custom jsonpFunction to prevent collisions with other splitChunks-using projects (https://github.com/woocommerce/woocommerce-blocks/pull/520) --- plugins/woocommerce-blocks/webpack.config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/woocommerce-blocks/webpack.config.js b/plugins/woocommerce-blocks/webpack.config.js index 68268e22d71..1b4856262dc 100644 --- a/plugins/woocommerce-blocks/webpack.config.js +++ b/plugins/woocommerce-blocks/webpack.config.js @@ -52,7 +52,12 @@ const GutenbergBlocksConfig = { output: { path: path.resolve( __dirname, './build/' ), filename: '[name].js', + library: [ 'wc', 'blocks', '[name]' ], libraryTarget: 'this', + // This fixes an issue with multiple webpack projects using chunking + // overwriting each other's chunk loader function. + // See https://webpack.js.org/configuration/output/#outputjsonpfunction + jsonpFunction: 'webpackWcBlocksJsonp', }, externals, optimization: {