-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathwebpack.config.js
63 lines (62 loc) · 1.48 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
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
// const webpack = require("webpack");
// https://webpack.js.org/configuration/
module.exports = {
entry: {
main: path.join(__dirname, '_webpack', 'main'),
},
output: {
path: path.resolve(__dirname, 'assets'),
filename: '[name]-bundle.js',
},
resolve: {
extensions: ['.json', '.js', '.jsx'],
modules: ['node_modules'],
},
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true, // set to true if you want JS source maps
}),
],
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
{
test: /\.scss$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
importLoaders: 1, // https://webpack.js.org/loaders/postcss-loader/
},
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: function () {
return [
require('autoprefixer'),
require('cssnano'),
];
},
},
},
},
{
loader: 'sass-loader',
options: {},
},
],
},
],
},
};