-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
64 lines (63 loc) · 1.59 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
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { ModuleFederationPlugin } = require("webpack").container;
const path = require("path");
const deps = require("./package.json").dependencies;
module.exports = {
entry: "./src/index.ts",
mode: "development",
devServer: {
static: path.join(__dirname, "dist"),
port: 3004,
open: false,
},
output: {
publicPath: "http://localhost:3004/",
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
module: {
rules: [
{
test: /\.(js|jsx|tsx|ts)$/,
loader: "ts-loader",
exclude: /node_modules/,
},
],
},
plugins: [
new ModuleFederationPlugin({
name: "users",
library: { type: "var", name: "users" },
filename: "usersRemoteEntry.js",
exposes: {
// expose each component
"./Users": "./src/components/Users",
},
shared: {
...deps,
react: { singleton: true, eager: true, requiredVersion: deps.react },
uuid: { singleton: true, eager: true, requiredVersion: deps.uuid },
"react-dom": {
singleton: true,
eager: true,
requiredVersion: deps["react-dom"],
},
"@mui/material": {
singleton: true,
eager: true,
requiredVersion: deps["@mui/material"],
},
"@mui/x-data-grid": {
singleton: true,
eager: true,
requiredVersion: deps["@mui/x-data-grid"],
},
},
}),
new HtmlWebpackPlugin({
template: "./public/index.dev.html",
}),
],
performance: { hints: false },
};