-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
38 lines (35 loc) · 1014 Bytes
/
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
const { merge } = require("webpack-merge");
const singleSpaDefaults = require("webpack-config-single-spa-react-ts");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const packageJsonAppName = require('./package.json').name;
const modderId = /^@([a-z0-9\-]+)\//g.exec(packageJsonAppName)[1]
const appId = /\/([a-z0-9\-]+)$/g.exec(packageJsonAppName)[1]
console.log(`modderId = ${modderId}; appId = ${appId}`);
module.exports = (webpackConfigEnv, argv) => {
const defaultConfig = singleSpaDefaults({
orgName: modderId,
projectName: appId,
webpackConfigEnv,
argv,
});
return merge(defaultConfig, {
entry: "./src/react-app.tsx",
plugins: [
new MiniCssExtractPlugin({
filename: `${modderId}-${appId}.css`
}),
],
module: {
rules: [
{
test: /\.(s[ac]|c)ss$/i,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader",
],
}
],
},
});
};