-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathwebpack.shell.config.js
60 lines (58 loc) · 1.41 KB
/
webpack.shell.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
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const shell = {
entry: ["./shell/main", "./shell/styles.css"],
mode: "development",
devServer: {
contentBase: path.join(__dirname, "dist/shell"),
port: 5000
},
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [ '.ts', '.js' ],
},
output: {
publicPath: "http://localhost:5000/",
uniqueName: 'shell',
path: path.join(__dirname, "dist/shell"),
filename: '[name].js'
},
plugins: [
new MiniCssExtractPlugin(),
new ModuleFederationPlugin({
name: "shell",
remoteType: 'var',
library: { type: "var", name: "shell" },
remotes: {
mfe1: "mfe1"
},
shared: {
"rxjs": {},
"libs/shared-lib/index.ts": {
import: "shared-lib",
packageName: "shared-lib",
shareKey: "shared-lib",
requiredVersion: "0.0.1" // or false
}
}
}),
new HtmlWebpackPlugin({
template: "./shell/index.html"
})
]
};
module.exports = shell;