@module-federation/nextjs-mf 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -228,7 +228,7 @@ class ChildFederation {
|
|
|
228
228
|
}),
|
|
229
229
|
new webpack.web.JsonpTemplatePlugin(childOutput),
|
|
230
230
|
new LoaderTargetPlugin('web'),
|
|
231
|
-
new LibraryPlugin(
|
|
231
|
+
new LibraryPlugin(this._options.library.type),
|
|
232
232
|
new webpack.DefinePlugin({
|
|
233
233
|
'process.env.REMOTES': JSON.stringify(this._options.remotes),
|
|
234
234
|
'process.env.CURRENT_HOST': JSON.stringify(this._options.name),
|
|
@@ -430,6 +430,14 @@ class NextFederationPlugin {
|
|
|
430
430
|
);
|
|
431
431
|
this._options.remotes = parsedRemotes;
|
|
432
432
|
}
|
|
433
|
+
if(this._options.library) {
|
|
434
|
+
console.error('[mf] you cannot set custom library');
|
|
435
|
+
}
|
|
436
|
+
this._options.library = {
|
|
437
|
+
// assign remote name to object to avoid SWC mangling top level variable
|
|
438
|
+
type: 'window',
|
|
439
|
+
name: this._options.name,
|
|
440
|
+
};
|
|
433
441
|
}
|
|
434
442
|
|
|
435
443
|
apply(compiler) {
|
package/lib/loaders/helpers.js
CHANGED
|
@@ -23,10 +23,10 @@ module.exports.hasLoader = function hasLoader(rule, loaderName) {
|
|
|
23
23
|
const loader = rule.use[i];
|
|
24
24
|
// check exact name, eg "url-loader" or its path "node_modules/url-loader/dist/cjs.js"
|
|
25
25
|
if (
|
|
26
|
-
loader.loader &&
|
|
27
|
-
loader.loader === loaderName ||
|
|
28
|
-
|
|
29
|
-
)
|
|
26
|
+
loader.loader &&
|
|
27
|
+
(loader.loader === loaderName ||
|
|
28
|
+
loader.loader.includes(`/${loaderName}/`))
|
|
29
|
+
) {
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"public": true,
|
|
3
3
|
"name": "@module-federation/nextjs-mf",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.1",
|
|
5
5
|
"description": "Module Federation helper for NextJS",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"demo": "yarn build && cd demo && yarn install && yarn dev",
|
|
13
13
|
"prettier": "prettier --write \"**/*.{js,json,md,ts,tsx}\"",
|
|
14
|
-
"build": "rm -rf lib && cp -r ./src/ lib/ && rollup -c"
|
|
14
|
+
"build": "rm -rf lib && cp -r ./src/ lib/ && rollup -c",
|
|
15
|
+
"prepublishOnly": "yarn build"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"chalk": "^4.0.0",
|