1 | const createVariants = require("parallel-webpack").createVariants;
|
2 | const TerserPlugin = require("terser-webpack-plugin");
|
3 |
|
4 | function createConfig(options) {
|
5 | return {
|
6 | entry: __dirname + "/src/app.js",
|
7 | output: {
|
8 | path: __dirname + "/build",
|
9 | filename:
|
10 | "waveform-playlist." +
|
11 | options.target +
|
12 | (options.minified ? ".min" : "") +
|
13 | ".js",
|
14 | library: {
|
15 | name: "WaveformPlaylist",
|
16 | type: options.target,
|
17 | },
|
18 | },
|
19 | optimization: {
|
20 | minimize: options.minified,
|
21 | minimizer: [new TerserPlugin()],
|
22 | },
|
23 | mode: "production",
|
24 | };
|
25 | }
|
26 |
|
27 | module.exports = createVariants(
|
28 | {
|
29 | minified: [true, false],
|
30 | target: ["var", "commonjs2", "umd", "amd"],
|
31 | },
|
32 | createConfig
|
33 | );
|