-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
42 lines (39 loc) · 983 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
39
40
41
42
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
module.exports = (env, argv) => {
if(!argv.name)
throw "Set Folder Name: npm run less -- --name={name}";
function abspath(relpath) {
return path.resolve(__dirname, './'+argv.name+'/'+relpath);
}
return {
mode: "production",
entry: {
mobile: abspath('custom_mobile.less'),
desktop: abspath('custom_desktop.less')
},
output: {
path: abspath('dist'),
filename: "no-use-[name].js"
},
module: {
rules: [{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"less-loader"
]
}]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name]-min.css'
})
],
optimization: {
minimizer: [new OptimizeCSSAssetsPlugin({})]
}
}
};