summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/examples/sourcemaps-reload-compressed/v1/webpack.config.js
blob: 0c45c7e1718754e0ec5a0aba7c3fb5e13f8f7d1f (plain)
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
const path = require("path");
const webpack = require("webpack");

const config = {
  devtool: "sourcemap",
};

if (webpack.version && webpack.version[0] === "4") {
  // Webpack 3, used in sourcemaps-reload-uncompressed, doesn't support mode attribute.
  // Webpack 4, used in sourcemaps-reload-compressed we want production mode in order to compress the sources
  config.mode = "production";
} else {
  // Also Webpack 4 doesn't support the module.loaders attribute
  config.module = {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: "babel-loader",
      },
    ],
  };
}

const originalBundle = Object.assign({}, config, {
  entry: [path.join(__dirname, "original.js")],
  output: {
    path: __dirname,
    filename: "bundle.js",
  },
});

const bundleWithAnotherOriginalFile = Object.assign({}, config, {
  entry: [path.join(__dirname, "original-with-no-update.js")],
  output: {
    path: __dirname,
    filename: "bundle-with-another-original.js"
  }
});

const replacedBundle = Object.assign({}, config, {
  entry: [path.join(__dirname, "removed-original.js")],
  output: {
    path: __dirname,
    filename: "replaced-bundle.js",
  },
});

module.exports = [originalBundle, bundleWithAnotherOriginalFile, replacedBundle];