-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.production.js
47 lines (38 loc) · 1.28 KB
/
webpack.production.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
43
44
45
46
47
const buildTransformedCss = require('ljas-webpack/buildTransformedCss')
const { buildSourceMaps, loadFonts, loadImages } = require('ljas-webpack')
const { merge } = require('webpack-merge')
const { PATH_BUILD_PROD, PATH_SRC } = require('./PATHS')
module.exports = merge([
{
mode: 'production',
output: {
assetModuleFilename: '[name].[contenthash][ext][query]',
chunkFilename: '[name].[contenthash].js',
filename: '[name].[contenthash].js',
path: PATH_BUILD_PROD,
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'initial',
},
},
},
},
target: 'browserslist:production',
},
buildTransformedCss({
rule: { include: PATH_SRC },
miniCssExtractPlugin: { filename: '[name].[contenthash].css' },
}),
buildSourceMaps('source-map'),
loadFonts({
rule: { generator: { filename: 'assets/[name].[hash][ext][query]' } },
}),
loadImages({
rule: { generator: { filename: 'assets/[name].[hash][ext][query]' } },
}),
])