-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.prod.js
60 lines (59 loc) · 1.59 KB
/
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
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
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
mode: 'production',
devtool: 'source-map',
entry: {
main: './app/js/src/index.js',
slides: './app/js/slides/index.js',
},
output: {
filename: 'src/[name].bundle.js',
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'app/images', to: 'images' },
{ from: 'app/js/lib', to: 'src/lib' },
{ from: 'app/*.html', to: '[name].html' },
{ from: 'app/manifest.json', to: 'manifest.json' },
]
}),
],
module: {
rules: [{
test : /\.(png|jpg|svg|gif|ttf|woff|eot)$/,
use: [
{
loader: 'url-loader',
options: {
limit: false // <-- Do not convert images to Base64 or they will need to be decypted on every frame!!
}
}
]
},
{
test: /\.(css|scss)$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}, {
loader: 'sass-loader'
}]
}]
},
performance: {
hints: false
},
optimization: {
minimize: true,
minimizer: [
new CssMinimizerPlugin(),
new TerserPlugin({
test: /\.js(\?.*)?$/i,
}),
],
},
};