-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
/
webpack.config.js
67 lines (64 loc) · 1.32 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// eslint-disable-next-line node/no-unpublished-require
const { ModuleFederationPlugin } = require("../../../../").container;
const common = {
entry: {
main: "./index.js"
},
optimization: {
runtimeChunk: "single"
}
};
/** @type {ConstructorParameters<typeof ModuleFederationPlugin>[0]} */
const commonMF = {
runtime: false,
exposes: {
"./ComponentB": "./ComponentB",
"./ComponentC": "./ComponentC"
},
shared: ["react"]
};
/** @type {import("../../../../").Configuration[]} */
module.exports = [
{
...common,
output: {
filename: "[name].js",
uniqueName: "1-container-full"
},
plugins: [
new ModuleFederationPlugin({
name: "container",
library: { type: "commonjs-module" },
filename: "container.js",
remotes: {
containerA: "../0-container-full/container.js",
containerB: "./container.js"
},
...commonMF
})
]
},
{
...common,
experiments: {
outputModule: true
},
output: {
filename: "module/[name].mjs",
uniqueName: "1-container-full-mjs"
},
plugins: [
new ModuleFederationPlugin({
name: "container",
library: { type: "module" },
filename: "module/container.mjs",
remotes: {
containerA: "../../0-container-full/module/container.mjs",
containerB: "./container.mjs"
},
...commonMF
})
],
target: "node14"
}
];