-
Notifications
You must be signed in to change notification settings - Fork 27
/
webpack.config.js
94 lines (92 loc) · 2.35 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const webpack = require('webpack');
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const ProvidePlugin = require('webpack').ProvidePlugin;
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
module.exports = {
entry: {
'assets/engine.js': [
'./src/js/main.js'
],
'assets/style.css': [
'./src/css/style.css',
'perfect-scrollbar/dist/css/perfect-scrollbar.css'
]
},
output: {
filename: '[name]',
path: path.resolve(__dirname, 'dist'),
},
devtool: false,
plugins: [
new CleanWebpackPlugin(),
new ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
PIXI: 'pixi.js'
}),
new CopyPlugin([
{ from: './src/assets', to: 'assets' },
{ from: './src/robots.txt', to: 'robots.txt' },
{ from: './src/html/privacy.html', to: 'privacy.html' },
{ from: './src/html/contact.html', to: 'contact.html' },
]),
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/html/index.html',
minify: {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true
},
hash: true,
inject: 'head'
}),
new ExtractTextPlugin("assets/style.css"),
new webpack.SourceMapDevToolPlugin({
filename: '[name].map'
})
],
module: {
rules: [
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: {
loader: 'css-loader',
options: {
url: false
}
},
fallback: 'style-loader'
})
},
],
},
optimization: {
minimize: process.env.DEBUG != '1',
minimizer: [
new TerserPlugin({
extractComments: false,
sourceMap: true,
terserOptions: {
output: {
comments: false
}
},
}),
new OptimizeCssAssetsPlugin({
cssProcessorOptions: {
zindex: false,
},
})
],
}
}