2020-04-04 07:13:16 +08:00
|
|
|
const ModuleFederationPlugin = require("../../../../lib/container/ModuleFederationPlugin");
|
|
|
|
|
2020-04-04 12:31:52 +08:00
|
|
|
const webpack = require("../../../../");
|
|
|
|
|
|
|
|
function createConfig(system) {
|
|
|
|
const systemString = "" + system;
|
|
|
|
return {
|
|
|
|
externalsType: "system",
|
|
|
|
name: `system_${systemString}`,
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
parser: {
|
|
|
|
system
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
__SYSTEM__: systemString
|
|
|
|
}),
|
|
|
|
new ModuleFederationPlugin({
|
|
|
|
name: "container",
|
|
|
|
filename: "container.js",
|
|
|
|
remotes: {
|
|
|
|
abc: "ABC",
|
|
|
|
def: "DEF"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
createConfig(undefined),
|
|
|
|
createConfig(true),
|
|
|
|
createConfig(false)
|
|
|
|
];
|