From 3122e9c3cf3ac5083ec38de75698b602de7cc1c2 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 27 Feb 2023 19:04:17 -0500 Subject: [PATCH] MM-50810 Fix module loading issues caused by shared modules --- mattermost-plugin/webapp/webpack.config.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mattermost-plugin/webapp/webpack.config.js b/mattermost-plugin/webapp/webpack.config.js index 023369dc2..271b98fd2 100644 --- a/mattermost-plugin/webapp/webpack.config.js +++ b/mattermost-plugin/webapp/webpack.config.js @@ -132,11 +132,18 @@ if (TARGET_IS_PRODUCT) { const sharedObject = {}; for (const packageName of packageNames) { - // Set both versions to false so that the version of this module provided by the web app will be used sharedObject[packageName] = { - requiredVersion: false, + + // Ensure only one copy of this package is ever loaded singleton: true, - version: false, + + // Set this to false to prevent Webpack from packaging any "fallback" version of this package so that + // only the version provided by the web app will be used + import: false, + + // Set these to false so that any version provided by the web app will be accepted + requiredVersion: false, + version: false }; }