github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/webpack.protos.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  // tslint:disable:object-literal-sort-keys
    17  module.exports = (env) => ({
    18    entry: {
    19      protos: [env.dist === "ccl" ? "./ccl/src/js/protos" : "./src/js/protos"],
    20    },
    21  
    22    mode: "none",
    23  
    24    output: {
    25      filename: `protos.${env.dist}.dll.js`,
    26      path: path.resolve(__dirname, "dist"),
    27      library: "[name]_[hash]",
    28    },
    29  
    30    module: {
    31      rules: [
    32        {
    33          test: /\.js$/,
    34          use: ["cache-loader", "thread-loader", "babel-loader"],
    35        },
    36      ],
    37    },
    38  
    39    plugins: [
    40      new webpack.DllPlugin({
    41        name: "[name]_[hash]",
    42        path: path.resolve(__dirname, `protos.${env.dist}.manifest.json`),
    43      }),
    44    ],
    45  
    46    // Max size of is set to 4Mb to disable warning message and control
    47    // the growing size of bundle over time.
    48    performance: {
    49      maxEntrypointSize: 4000000,
    50      maxAssetSize: 4000000,
    51    },
    52  });