Completed
Branch master (7e47d5)
by Muhammad
02:40 queued 44s
created

webpack.config.js (1 issue)

Severity
1
const path = require("path");
2
const TerserPlugin = require('terser-webpack-plugin');
3
const env = process.env.NODE_ENV;
4
5
const config = {
0 ignored issues
show
The constant config seems to be never used. Consider removing it.
Loading history...
6
    mode: env || 'development'
7
};
8
9
module.exports = (env, options) => {
10
    return {
11
        devtool: "source-map",
12
        target: "async-node",
13
        entry: ["./src/js-loading-overlay.js"],
14
        output: {
15
            filename: options.mode == 'development' ? "dist/js-loading-overlay.js" : "dist/js-loading-overlay.min.js",
16
            path: path.resolve(__dirname, ''),
17
        },
18
        module: {
19
            rules: [{
20
                test: /\.js$/,
21
                exclude: /node_modules/,
22
                loader: 'babel-loader',
23
            }]
24
        },
25
        optimization: {
26
            minimizer: [
27
                new TerserPlugin({
28
                    extractComments: true,
29
                    cache: true,
30
                    parallel: true,
31
                    sourceMap: true, // Must be set to true if using source-maps in production
32
                    terserOptions: {
33
                        // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
34
                        extractComments: 'all',
35
                        compress: {
36
                            drop_console: true,
37
                        },
38
                        output: {
39
                            comments: false,
40
                        },
41
                    }
42
                }),
43
            ],
44
        }
45
    }
46
};