tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

webpack.config.js (1278B)


      1 const path = require("path");
      2 const webpack = require("webpack");
      3 
      4 const config = {
      5  devtool: "sourcemap",
      6 };
      7 
      8 if (webpack.version && webpack.version[0] === "4") {
      9  // Webpack 3, used in sourcemaps-reload-uncompressed, doesn't support mode attribute.
     10  // Webpack 4, used in sourcemaps-reload-compressed we want production mode in order to compress the sources
     11  config.mode = "production";
     12 } else {
     13  // Also Webpack 4 doesn't support the module.loaders attribute
     14  config.module = {
     15    loaders: [
     16      {
     17        test: /\.js$/,
     18        exclude: /node_modules/,
     19        loader: "babel-loader",
     20      },
     21    ],
     22  };
     23 }
     24 
     25 const originalBundle = Object.assign({}, config, {
     26  entry: [path.join(__dirname, "original.js")],
     27  output: {
     28    path: __dirname,
     29    filename: "bundle.js",
     30  },
     31 });
     32 
     33 const bundleWithAnotherOriginalFile = Object.assign({}, config, {
     34  entry: [path.join(__dirname, "original-with-no-update.js")],
     35  output: {
     36    path: __dirname,
     37    filename: "bundle-with-another-original.js"
     38  }
     39 });
     40 
     41 const replacedBundle = Object.assign({}, config, {
     42  entry: [path.join(__dirname, "removed-original.js")],
     43  output: {
     44    path: __dirname,
     45    filename: "replaced-bundle.js",
     46  },
     47 });
     48 
     49 module.exports = [originalBundle, bundleWithAnotherOriginalFile, replacedBundle];