-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.cjs
41 lines (39 loc) · 1 KB
/
webpack.config.cjs
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
const path = require('path');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const isProd = process.env.NODE_ENV === 'production';
const isDev = !isProd;
module.exports = {
context: path.resolve(__dirname, 'source'),
mode: 'development',
entry: {
main: './js/main.js',
vendor: './js/vendor.js',
},
devtool: isDev ? 'source-map' : false,
output: {
filename: '[name].min.js',
path: path.resolve(__dirname, 'build/js'),
},
optimization: {
minimize: isDev ? false : true,
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
}
],
},
plugins: [
new CleanWebpackPlugin(),
new DuplicatePackageCheckerPlugin(),
new CircularDependencyPlugin()
],
};