-
Notifications
You must be signed in to change notification settings - Fork 0
/
extra-webpack.config.js
49 lines (46 loc) · 1.81 KB
/
extra-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
const webpack = require('webpack');
const pkg = require('./package.json');
const path = require("path");
const { ModuleFederationPlugin } = require('webpack').container;
const { dependencies } = require('./package.json');
const aliases = {
'styled-components': path.join(path.resolve(__dirname, '.'), "node_modules", "styled-components"),
'react': path.join(path.resolve(__dirname, '.'), "node_modules", "react"),
'react-dom': path.join(path.resolve(__dirname, '.'), "node_modules", "react-dom"),
'react-router-dom': path.join(path.resolve(__dirname, '.'), "node_modules", "react-router-dom"),
'i18next': path.join(path.resolve(__dirname, '.'), "node_modules", "i18next"),
'react-i18next': path.join(path.resolve(__dirname, '.'), "node_modules", "react-i18next")
};
module.exports = (webpackConfig, options) => {
const webpackVariable = {
...webpackConfig,
resolve: {
...webpackConfig.resolve,
alias: aliases
},
plugins: [
...webpackConfig.plugins,
new ModuleFederationPlugin({
name: "business-cockpit",
shared: {
react: {
eager: true,
singleton: true,
requiredVersion: dependencies["react"],
},
"react-dom": {
eager: true,
singleton: true,
requiredVersion: dependencies["react-dom"],
},
"react-router-dom": {
eager: true,
singleton: true,
requiredVersion: dependencies["react-router-dom"],
},
},
}),
]
}
return webpackVariable;
};