Skip to content

Commit

Permalink
feat(enhanced): support layers
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedAlchemy committed Nov 17, 2024
1 parent 5b107fa commit 062706f
Show file tree
Hide file tree
Showing 7 changed files with 386 additions and 324 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
"vue-tsc": "^2.0.26",
"wait-on": "^7.2.0",
"webpack": "5.93.0",
"webpack-cli": "^5.1.4",
"webpack-virtual-modules": "0.6.2",
"whatwg-fetch": "^3.6.20",
"yargs": "^17.7.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/.federation
3 changes: 1 addition & 2 deletions packages/enhanced/test/configCases/sharing/layers/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import * as ReactLayer1 from 'react/layer1';

it('should load different versions from different layers', () => {
expect(React.version).toBe('1.0.0');
expect(ReactLayer1.version).toBe('2.0.0');
expect(__webpack_modules__['./node_modules/react/index.js']);
});

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
"name": "layered-react-test",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "webpack --config=webpack.config.js"
},
"dependencies": {
"react": "1.0.0"
},
"layerDependencies": {
"layer1": {
"react": "2.0.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const ModuleFederationPlugin =
require('../../../../src/index').ModuleFederationPlugin;
const { ModuleFederationPlugin } = require('../../../../dist/src');

module.exports = {
mode: 'development',
devtool: false,
entry: {
main: {
import: './index.js',
Expand All @@ -18,6 +19,11 @@ module.exports = {
issuerLayer: 'entry-layer',
layer: 'loader-layer',
},
{
test: /react/,
issuerLayer: 'entry-layer',
layer: 'loader-layer',
},
],
},
plugins: [
Expand Down
686 changes: 372 additions & 314 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

0 comments on commit 062706f

Please sign in to comment.