webpack.config.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 42
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 29
mnd 1
bc 1
fnc 1
dl 0
loc 42
rs 10
bpm 1
cpm 2
noi 0
c 0
b 0
f 0
1
const path = require("path");
2
const TerserPlugin = require('terser-webpack-plugin');
3
const env = process.env.NODE_ENV;
4
5
module.exports = (env, options) => {
6
    return {
7
        devtool: "source-map",
8
        target: "async-node",
9
        entry: ["./src/js-loading-overlay.js"],
10
        output: {
11
            filename: options.mode == 'development' ? "dist/js-loading-overlay.js" : "dist/js-loading-overlay.min.js",
12
            path: path.resolve(__dirname, ''),
13
        },
14
        module: {
15
            rules: [{
16
                test: /\.js$/,
17
                exclude: /node_modules/,
18
                loader: 'babel-loader',
19
            }]
20
        },
21
        optimization: {
22
            minimizer: [
23
                new TerserPlugin({
24
                    extractComments: true,
25
                    cache: true,
26
                    parallel: true,
27
                    sourceMap: true, // Must be set to true if using source-maps in production
28
                    terserOptions: {
29
                        // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
30
                        extractComments: 'all',
31
                        compress: {
32
                            drop_console: true,
33
                        },
34
                        output: {
35
                            comments: false,
36
                        },
37
                    }
38
                }),
39
            ],
40
        }
41
    }
42
};