@module-federation/nextjs-mf 5.11.5 → 5.12.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.
- package/CHANGELOG.md +87 -0
- package/README.md +33 -33
- package/package.json +3 -3
- package/src/loaders/fixImageLoader.js +1 -1
- package/src/loaders/fixImageLoader.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,93 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [5.12.2](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.12.1...nextjs-mf-5.12.2) (2022-11-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [5.12.1](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.12.0...nextjs-mf-5.12.1) (2022-11-20)
|
|
10
|
+
|
|
11
|
+
### Dependency Updates
|
|
12
|
+
|
|
13
|
+
* `node` updated to version `0.9.1`
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [5.12.1](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.12.0...nextjs-mf-5.12.1) (2022-11-20)
|
|
17
|
+
|
|
18
|
+
### Dependency Updates
|
|
19
|
+
|
|
20
|
+
* `node` updated to version `0.9.1`
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [5.12.2](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.12.1...nextjs-mf-5.12.2) (2022-11-20)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [5.12.1](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.12.0...nextjs-mf-5.12.1) (2022-11-20)
|
|
28
|
+
|
|
29
|
+
### Dependency Updates
|
|
30
|
+
|
|
31
|
+
* `node` updated to version `0.9.1`
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [5.12.1](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.12.0...nextjs-mf-5.12.1) (2022-11-20)
|
|
35
|
+
|
|
36
|
+
### Dependency Updates
|
|
37
|
+
|
|
38
|
+
* `node` updated to version `0.9.1`
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [5.12.1](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.12.0...nextjs-mf-5.12.1) (2022-11-20)
|
|
42
|
+
|
|
43
|
+
### Dependency Updates
|
|
44
|
+
|
|
45
|
+
* `node` updated to version `0.9.1`
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# [5.12.0](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.11.2...nextjs-mf-5.12.0) (2022-11-20)
|
|
49
|
+
|
|
50
|
+
### Dependency Updates
|
|
51
|
+
|
|
52
|
+
* `node` updated to version `0.9.0`
|
|
53
|
+
* `utils` updated to version `1.0.1`
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* Better page regex ([#346](https://github.com/module-federation/nextjs-mf/issues/346)) ([b525d3b](https://github.com/module-federation/nextjs-mf/commit/b525d3b579af2ac3a8b502f3c996de8726dbcadd))
|
|
58
|
+
* better page regex for adding loaders ([72fef27](https://github.com/module-federation/nextjs-mf/commit/72fef2792dc39c7605f8b9f8136f5d18a46a3fe5))
|
|
59
|
+
* Fix peer deps ([#343](https://github.com/module-federation/nextjs-mf/issues/343)) ([8e7b087](https://github.com/module-federation/nextjs-mf/commit/8e7b0871507911bb81161b9786901877259edaed))
|
|
60
|
+
* include styled-jsx/style in defaults share ([#347](https://github.com/module-federation/nextjs-mf/issues/347)) ([cb0675b](https://github.com/module-federation/nextjs-mf/commit/cb0675be8e3a4fe0ec89ef7f190610392bb16b6d))
|
|
61
|
+
* update version ([70bda37](https://github.com/module-federation/nextjs-mf/commit/70bda37744f55af849bd5c28684f42851bbf7d1f))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Features
|
|
65
|
+
|
|
66
|
+
* support ssr remote entry images ([9ab2afa](https://github.com/module-federation/nextjs-mf/commit/9ab2afaef5115ae6677641cb9d021273dafebf86))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# [5.12.0](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.11.2...nextjs-mf-5.12.0) (2022-11-20)
|
|
71
|
+
|
|
72
|
+
### Dependency Updates
|
|
73
|
+
|
|
74
|
+
* `node` updated to version `0.9.0`
|
|
75
|
+
* `utils` updated to version `1.0.0`
|
|
76
|
+
|
|
77
|
+
### Bug Fixes
|
|
78
|
+
|
|
79
|
+
* Better page regex ([#346](https://github.com/module-federation/nextjs-mf/issues/346)) ([b525d3b](https://github.com/module-federation/nextjs-mf/commit/b525d3b579af2ac3a8b502f3c996de8726dbcadd))
|
|
80
|
+
* better page regex for adding loaders ([72fef27](https://github.com/module-federation/nextjs-mf/commit/72fef2792dc39c7605f8b9f8136f5d18a46a3fe5))
|
|
81
|
+
* Fix peer deps ([#343](https://github.com/module-federation/nextjs-mf/issues/343)) ([8e7b087](https://github.com/module-federation/nextjs-mf/commit/8e7b0871507911bb81161b9786901877259edaed))
|
|
82
|
+
* include styled-jsx/style in defaults share ([#347](https://github.com/module-federation/nextjs-mf/issues/347)) ([cb0675b](https://github.com/module-federation/nextjs-mf/commit/cb0675be8e3a4fe0ec89ef7f190610392bb16b6d))
|
|
83
|
+
* update version ([70bda37](https://github.com/module-federation/nextjs-mf/commit/70bda37744f55af849bd5c28684f42851bbf7d1f))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Features
|
|
87
|
+
|
|
88
|
+
* support ssr remote entry images ([9ab2afa](https://github.com/module-federation/nextjs-mf/commit/9ab2afaef5115ae6677641cb9d021273dafebf86))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
5
92
|
## [5.11.3](https://github.com/module-federation/nextjs-mf/compare/nextjs-mf-5.11.2...nextjs-mf-5.11.3) (2022-10-26)
|
|
6
93
|
|
|
7
94
|
|
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ new NextFederationPlugin({
|
|
|
112
112
|
exposePages: true, // `false` by default
|
|
113
113
|
enableImageLoaderFix: true, // `false` by default
|
|
114
114
|
enableUrlLoaderFix: true, // `false` by default
|
|
115
|
-
automaticAsyncBoundary: true // `false` by default
|
|
115
|
+
automaticAsyncBoundary: true, // `false` by default
|
|
116
116
|
skipSharingNextInternals: false // `false` by default
|
|
117
117
|
},
|
|
118
118
|
});
|
|
@@ -134,29 +134,30 @@ You can see it in action here: https://github.com/module-federation/module-feder
|
|
|
134
134
|
|
|
135
135
|
```js
|
|
136
136
|
// next.config.js
|
|
137
|
-
|
|
137
|
+
// either from default
|
|
138
|
+
const NextFederationPlugin = require('@module-federation/nextjs-mf').default;
|
|
139
|
+
// or named export
|
|
140
|
+
const { NextFederationPlugin } = require('@module-federation/nextjs-mf');
|
|
138
141
|
|
|
139
142
|
module.exports = {
|
|
140
143
|
webpack(config, options) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
);
|
|
159
|
-
}
|
|
144
|
+
const { isServer } = options;
|
|
145
|
+
config.plugins.push(
|
|
146
|
+
new NextFederationPlugin({
|
|
147
|
+
name: 'next2',
|
|
148
|
+
remotes: {
|
|
149
|
+
next1: `next1@http://localhost:3001/_next/static/${isServer ? 'ssr' : 'chunks'}/remoteEntry.js`,
|
|
150
|
+
},
|
|
151
|
+
filename: 'static/chunks/remoteEntry.js',
|
|
152
|
+
exposes: {
|
|
153
|
+
'./title': './components/exposedTitle.js',
|
|
154
|
+
'./checkout': './pages/checkout',
|
|
155
|
+
},
|
|
156
|
+
shared: {
|
|
157
|
+
// whatever else
|
|
158
|
+
},
|
|
159
|
+
})
|
|
160
|
+
);
|
|
160
161
|
|
|
161
162
|
return config;
|
|
162
163
|
},
|
|
@@ -173,20 +174,19 @@ import '@module-federation/nextjs-mf/lib/include-defaults';
|
|
|
173
174
|
```js
|
|
174
175
|
// next.config.js
|
|
175
176
|
|
|
176
|
-
const NextFederationPlugin = require('@module-federation/nextjs-mf
|
|
177
|
+
const { NextFederationPlugin } = require('@module-federation/nextjs-mf');
|
|
177
178
|
|
|
178
179
|
module.exports = {
|
|
179
180
|
webpack(config, options) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
181
|
+
const { isServer } = options;
|
|
182
|
+
config.plugins.push(
|
|
183
|
+
new NextFederationPlugin({
|
|
184
|
+
name: 'next1',
|
|
185
|
+
remotes: {
|
|
186
|
+
next2: `next2@http://localhost:3000/_next/static/${isServer ? 'ssr' : 'chunks'}/remoteEntry.js`,
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
190
|
|
|
191
191
|
return config;
|
|
192
192
|
},
|
|
@@ -223,7 +223,7 @@ Ive added a util for dynamic chunk loading, in the event you need to load remote
|
|
|
223
223
|
**InjectScript**
|
|
224
224
|
|
|
225
225
|
```js
|
|
226
|
-
import { injectScript } from '@module-federation/nextjs-mf/
|
|
226
|
+
import { injectScript } from '@module-federation/nextjs-mf/utils';
|
|
227
227
|
// if i have remotes in my federation plugin, i can pass the name of the remote
|
|
228
228
|
injectScript('home').then((remoteContainer) => {
|
|
229
229
|
remoteContainer.get('./exposedModule');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/nextjs-mf",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"fast-glob": "^3.2.11",
|
|
20
20
|
"webpack-sources": "^3.2.3",
|
|
21
21
|
"eventemitter3": "^4.0.7",
|
|
22
|
-
"@module-federation/node": "0.
|
|
23
|
-
"@module-federation/utilities": "0.
|
|
22
|
+
"@module-federation/node": "0.9.1",
|
|
23
|
+
"@module-federation/utilities": "1.0.1",
|
|
24
24
|
"@swc/core": "^1.3.3",
|
|
25
25
|
"tslib": "^2.3.0"
|
|
26
26
|
},
|
|
@@ -24,7 +24,7 @@ async function fixImageLoader(remaining) {
|
|
|
24
24
|
const result = await this.importModule(`${this.resourcePath}.webpack[javascript/auto]` + `!=!${remaining}`);
|
|
25
25
|
const content = (result.default || result);
|
|
26
26
|
const computedAssetPrefix = isServer
|
|
27
|
-
? `
|
|
27
|
+
? `new URL(global.__remote_scope__._config[global.remoteEntryName]).origin`
|
|
28
28
|
: `(${publicPath} && ${publicPath}.indexOf('://') > 0 ? new URL(${publicPath}).origin : '')`;
|
|
29
29
|
const constructedObject = Object.entries(content).reduce((acc, [key, value]) => {
|
|
30
30
|
if (key === 'src') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixImageLoader.js","sourceRoot":"","sources":["../../../../../packages/nextjs-mf/src/loaders/fixImageLoader.ts"],"names":[],"mappings":";;;;AAEA,qCAAmC;AACnC,wDAAwB;AAExB;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,cAAc,CAElC,SAAiB;IAEjB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAErB,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC;IACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC;IAE3D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CACpC,GAAG,IAAI,CAAC,YAAY,2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