Skip to content

Commit

Permalink
#8586 Make eager option configurable for extensions shared libraries (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fedorenko authored Sep 14, 2022
1 parent 703f4cf commit 3c31f3c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions build/createExtensionWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
* @param {boolean} cfg.prod discriminates the production or development environment
* @param {string} cfg.name the name of the plugin/extension
* @param {object} cfg.exposes this is the main entry point of the module federation plugin. For MapStore extension plugin it must be { './plugin': "path/to/the/plugin/file>"}
* @param {boolean} cfg.sharedLibrariesEager this flag controls whether shared libraries should be included into index.js of extensions or loaded asynchronously
* @param {object} cfg.alias aliases for the JS build
* @param {object} cfg.publicPath the publicPath, useful for debugging
* @param {string} cfg.destination the destination folder of the build packages
* @param {array} cfg.plugins additional plugins, more then the default ones.
* @param {object} cfg.overrides any other configuration you want to add to the configuration.
*/
module.exports = ({ prod = true, name, exposes, alias = {}, publicPath, destination, plugins = [], overrides = {} }) => ({
module.exports = ({ prod = true, name, exposes, sharedLibrariesEager = true, alias = {}, publicPath, destination, plugins = [], overrides = {} }) => ({
target: "web",
mode: prod ? "production" : "development",
entry: {},
Expand All @@ -44,7 +45,10 @@ module.exports = ({ prod = true, name, exposes, alias = {}, publicPath, destinat
name,
filename: "index.js", // "bundle.[chunkhash:8].js", // [chunkhash:8]
exposes,
shared
shared: Object.keys(shared).reduce((prev, el) => {
prev[el] = {...shared[el], eager: sharedLibrariesEager};
return prev;
}, {})
}),
new MiniCssExtractPlugin({
filename: "assets/css/[name].css"
Expand Down

0 comments on commit 3c31f3c

Please sign in to comment.