-
Notifications
You must be signed in to change notification settings - Fork 56
/
webpack.config.js
53 lines (47 loc) · 1.38 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
const webpack = require('webpack');
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const INPUT_DIR = path.resolve(__dirname, './assets/src');
const OUTPUT_DIR = path.resolve(__dirname, './assets/dist');
module.exports = {
entry: path.resolve(INPUT_DIR, 'index.js'),
output: {
path: OUTPUT_DIR,
filename: 'bundle.js'
},
module: {
rules: [{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
}],
},
optimization: {
minimizer: [
// https://webpack.js.org/plugins/terser-webpack-plugin/
new TerserPlugin(),
// https://webpack.js.org/plugins/css-minimizer-webpack-plugin/
new CssMinimizerPlugin(),
],
},
plugins: [
// https://webpack.js.org/plugins/mini-css-extract-plugin/
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
filename: '[name].css',
chunkFilename: '[id].css'
}),
// Makes jQuery (required for bootstrap4) available to other JS includes
// https://webpack.js.org/plugins/provide-plugin/
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
]
};