This repository was archived by the owner on Apr 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
64 lines (57 loc) · 1.4 KB
/
webpack.prod.js
File metadata and controls
64 lines (57 loc) · 1.4 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { merge } from 'webpack-merge';
import common from './webpack.common';
import { resolve } from 'path';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
const commonProd = {
mode: 'production',
devtool: 'source-map',
module: {
rules: [
{
test: /\.(css|less)$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'less-loader'
]
}
]
}
}
const config = merge(commonProd, common, {
output: {
filename: '[name].bundle.js',
path: resolve(__dirname, 'dist'),
publicPath: '/'
},
plugins: [
//Generate an external css file
new MiniCssExtractPlugin( {
filename: '[name].css'
})
]
});
const modularizedCSSconfig = merge(commonProd, {
entry: {
/*============================================
NOTE: Always update the entry point in the dev
config with whatever new entry points you add
here.
============================================*/
//library (modules styles) entry points
reset: './src/library/js/modules/reset.js',
display: './src/library/js/modules/display.js'
},
output: {
filename: '[name].bundle.js',
path: resolve(__dirname, 'dist/modules/'),
publicPath: '/'
},
plugins: [
//Generate an external css file
new MiniCssExtractPlugin( {
filename: '[name].css'
})
]
});
export default [config, modularizedCSSconfig];