-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nextjs-mf): update module share for rsc
- Loading branch information
1 parent
10f2b73
commit f4ecfbf
Showing
20 changed files
with
216 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/next-app-router-4000/app/error-handling/[categorySlug]/[subCategorySlug]/error.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/next-app-router-4000/app/error-handling/[categorySlug]/error.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/enhanced/test/configCases/layers/9-layers-full/App.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React, { layeredComponentsReact } from 'react'; | ||
import other from 'react/other'; | ||
import ComponentA from 'containerA/ComponentA'; | ||
import RemoteApp from 'containerA/App'; | ||
import LocalComponentA from './ComponentA'; | ||
console.log(other); | ||
export default function App() { | ||
return `App (no layer) rendered with React version: [${React()}] with non-layered React value: [${layeredComponentsReact()}] | ||
Local Component: ${LocalComponentA()} | ||
Remote Component from container7: ${ComponentA()} | ||
Remote App from container7: ${RemoteApp()}`; | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/enhanced/test/configCases/layers/9-layers-full/ComponentA.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React, { layeredComponentsReact } from 'react'; | ||
|
||
export default function ComponentA() { | ||
return `LocalComponentA (in react-layer) rendered with React version: [${React()}], layered React value: [${layeredComponentsReact()}]`; | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/enhanced/test/configCases/layers/9-layers-full/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
it('should load App with React and both types of remote components', () => { | ||
return import('containerA/noop').then((m) => { | ||
return import('./App').then(({ default: App }) => { | ||
const rendered = App(); | ||
expect(rendered) | ||
.toBe(`App (no layer) rendered with React version: [This is react 0.1.2] with non-layered React value: [No Layer] | ||
Local Component: LocalComponentA (in react-layer) rendered with React version: [This is react 0.1.2], layered React value: [react-layer] | ||
Remote Component from container7: ComponentA (in react-layer) rendered with React version: [This is react 0.1.2] with layered React value: [react-layer] | ||
Remote App from container7: App (no layer) rendered with React version: [This is react 0.1.2] with non-layered React value: [No Layer] and imported: ComponentA (in react-layer) rendered with React version: [This is react 0.1.2] with layered React value: [react-layer]`); | ||
}); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/enhanced/test/configCases/layers/9-layers-full/layerImport.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import LocalComponentA from './ComponentA'; | ||
|
||
export default LocalComponentA; |
4 changes: 4 additions & 0 deletions
4
packages/enhanced/test/configCases/layers/9-layers-full/node_modules/react/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
packages/enhanced/test/configCases/layers/9-layers-full/node_modules/react/other.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
packages/enhanced/test/configCases/layers/9-layers-full/node_modules/react/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
packages/enhanced/test/configCases/layers/9-layers-full/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"private": true, | ||
"engines": { | ||
"node": ">=10.13.0" | ||
}, | ||
"scripts": { | ||
"build": "webpack --config=webpack.config.js" | ||
}, | ||
"dependencies": { | ||
"react": "*" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/enhanced/test/configCases/layers/9-layers-full/test.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
findBundle: function (i, options) { | ||
return './main.js'; | ||
return i === 0 ? './main.js' : './module/main.mjs'; | ||
}, | ||
}; |
87 changes: 87 additions & 0 deletions
87
packages/enhanced/test/configCases/layers/9-layers-full/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
const { ModuleFederationPlugin } = require('../../../../dist/src'); | ||
|
||
const common = { | ||
name: 'container_8', | ||
filename: 'container.js', | ||
remotes: { | ||
containerA: { | ||
external: '../7-layers-full/container.js', | ||
}, | ||
}, | ||
shared: { | ||
react: { | ||
singleton: true, | ||
requiredVersion: false, | ||
}, | ||
randomvalue: { | ||
request: 'react/', | ||
shareKey: 'react', | ||
singleton: true, | ||
requiredVersion: false, | ||
layer: 'react-layer', | ||
issuerLayer: 'react-layer', | ||
}, | ||
}, | ||
}; | ||
|
||
const commonConfig = { | ||
entry: './index.js', | ||
mode: 'development', | ||
devtool: false, | ||
experiments: { | ||
layers: true, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
layer: 'react-layer', | ||
test: /ComponentA\.js$/, | ||
}, | ||
{ | ||
test: /react\.js$/, | ||
issuerLayer: 'react-layer', | ||
layer: 'react-layer', | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
module.exports = [ | ||
{ | ||
...commonConfig, | ||
output: { | ||
filename: '[name].js', | ||
uniqueName: '8-layers-full', | ||
}, | ||
plugins: [ | ||
new ModuleFederationPlugin({ | ||
...common, | ||
library: { type: 'commonjs-module' }, | ||
}), | ||
], | ||
}, | ||
{ | ||
...commonConfig, | ||
experiments: { | ||
...commonConfig.experiments, | ||
outputModule: true, | ||
}, | ||
output: { | ||
filename: 'module/[name].mjs', | ||
uniqueName: '8-layers-full-mjs', | ||
}, | ||
plugins: [ | ||
new ModuleFederationPlugin({ | ||
...common, | ||
library: { type: 'module' }, | ||
filename: 'module/container.mjs', | ||
remotes: { | ||
containerA: { | ||
external: '../../7-layers-full/module/container.mjs', | ||
}, | ||
}, | ||
}), | ||
], | ||
target: 'node14', | ||
}, | ||
]; |
Oops, something went wrong.