forked from manfredsteyer/federation-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.mfe1.config.js
66 lines (64 loc) · 1.89 KB
/
webpack.mfe1.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
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 TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const mfe1 = {
entry: "./mfe1/main",
mode: "development",
devServer: {
static: path.join(__dirname, "dist/mfe1"),
port: 3000
},
module: {
rules: [{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.ts$/,
use: {
loader: 'ts-loader',
options: {
configFile: 'tsconfig.json'
}
},
exclude: /node_modules/,
},
],
},
output: {
publicPath: "http://localhost:3000/",
uniqueName: 'mfe1',
path: path.join(__dirname, "dist/mfe1"),
filename: '[name].js'
},
resolve: {
extensions: ['.ts', '.js'],
plugins: [new TsconfigPathsPlugin({})]
},
plugins: [
new MiniCssExtractPlugin(),
new ModuleFederationPlugin({
name: "mfe1",
library: { type: "var", name: "mfe1" },
filename: "remoteEntry.js",
exposes: {
"./component": "./mfe1/component"
},
shared: {
"rxjs": {},
"shared-lib": {
import: "shared-lib",
packageName: "shared-lib",
shareKey: "shared-lib",
requiredVersion: "0.0.1" // or false
}
}
}),
new HtmlWebpackPlugin({
template: "./mfe1/index.html"
}),
]
};
module.exports = mfe1;