-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
35 lines (34 loc) · 873 Bytes
/
webpack.prod.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
const path = require("path");
const common = require("./webpack.common");
const {merge} = require("webpack-merge");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = merge(common, {
mode: "production",
output: {
filename: "script/[name].min.js",
path: path.resolve(__dirname, "dist"),
assetModuleFilename: 'assets/[name]-[hash][ext]',
library: "$story",
libraryTarget: "umd",
globalObject: 'this',
clean: true
},
module: {
rules: [
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader, // extract css -> file
"css-loader", // css -> js
"postcss-loader", // postcss plugin
"sass-loader" // sass -> css
]
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "style/[name].min.css",
})
]
});