const commonBuilder = require('pulito');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackInjectAttributesPlugin = require('html-webpack-inject-attributes-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { resolve } = require('path');

module.exports = (env, argv) => {
  const config = commonBuilder(env, argv, __dirname);
  config.output.publicPath = '/static/';

  // Don't minify the HTML since it contains Go template tags.
  config.plugins.forEach((c) => {
    if (c instanceof HtmlWebpackPlugin) {
      c.options.minify = false;
    }
  });

  config.plugins.push(
    new CopyWebpackPlugin([
      {
        from: resolve(__dirname, 'config.json'),
        to: 'config.json',
      },
    ]),
  );
  config.plugins.push(
    new HtmlWebpackInjectAttributesPlugin({
      nonce: '{% .Nonce %}',
    }),
  );
  config.resolve = config.resolve || {};
  // https://github.com/webpack/node-libs-browser/issues/26#issuecomment-267954095
  config.resolve.modules = [resolve(__dirname, 'node_modules')];
  return config;
};

@@ -38,66 +38,8 @@
 ');%0A
-const CopyWebpackPlugin = require('copy-webpack-plugin');%0A
 cons
@@ -540,165 +540,8 @@
 );%0A%0A
-  config.plugins.push(%0A    new CopyWebpackPlugin(%5B%0A      %7B%0A        from: resolve(__dirname, 'config.json'),%0A        to: 'config.json',%0A      %7D,%0A    %5D),%0A  );%0A
   co

Remove config.json copying from webpack.