forked from blink1073/module-federation-share-self
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
40 lines (39 loc) · 1015 Bytes
/
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
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const path = require("path");
module.exports = {
entry: "./index",
mode: "development",
devServer: {
contentBase: path.join(__dirname,
"dist"),
port: 3003,
},
output: {
publicPath: "http://localhost:3003/",
},
plugins: [
new ModuleFederationPlugin({
name: "module-federation-share-self",
library: {
type: "var", name: "module-federation-share-self"
},
filename: "remoteEntry.js",
exposes: {
"./index": "./index",
},
shared: {
"./index": {
shareKey: "module-federation-share-self",
version: require("./package.json").version,
singleton: true
},
"react": { singleton: true }
},
}),
new HtmlWebpackPlugin({
template: "./public/index.html",
}),
],
};