github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/webpack.vendor.js (about)

     1  // Copyright 2019 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  "use strict";
    12  
    13  const path = require("path");
    14  const webpack = require("webpack");
    15  
    16  const pkg = require("./package.json");
    17  
    18  const prodDependencies = Object.keys(pkg.dependencies);
    19  
    20  // tslint:disable:object-literal-sort-keys
    21  module.exports = {
    22    entry: {
    23      vendor: prodDependencies,
    24    },
    25  
    26    mode: "none",
    27  
    28    output: {
    29      filename: "vendor.oss.dll.js",
    30      path: path.resolve(__dirname, "dist"),
    31      library: "[name]_[hash]",
    32    },
    33  
    34    resolve: {
    35      modules: [path.resolve(__dirname, "node_modules")],
    36    },
    37  
    38    module: {
    39      rules: [
    40        {
    41          test: /\.js$/,
    42          // analytics-node is an es6 module and we must run it through babel. As
    43          // of 8/25/2017 there appears to be no better way to run babel only on
    44          // the specific packages in node_modules that actually use ES6.
    45          // https://github.com/babel/babel-loader/issues/171
    46          exclude: /node_modules\/(?!analytics-node)/,
    47          use: ["cache-loader", "thread-loader", "babel-loader"],
    48        },
    49      ],
    50    },
    51  
    52    plugins: [
    53      new webpack.DllPlugin({
    54        name: "[name]_[hash]",
    55        path: path.resolve(__dirname, "vendor.oss.manifest.json"),
    56      }),
    57    ],
    58  
    59    // Max size of is set to 4Mb to disable warning message and control
    60    // the growing size of bundle over time.
    61    performance: {
    62      maxEntrypointSize: 4000000,
    63      maxAssetSize: 4000000,
    64    },
    65  };