function getCommonWebpackConfig()

in dev-utils/build.js [196:241]


function getCommonWebpackConfig(bundleType, packageType) {
  const isEnvProduction = isProduction(bundleType)
  const mode = isEnvProduction ? 'production' : 'development'

  return {
    devtool: isEnvProduction ? 'source-map' : 'inline-cheap-module-source-map',
    mode,
    stats: {
      colors: true,
      assets: true,
      modules: false
    },
    performance: {
      hints: false
    },
    module: {
      rules: [
        {
          test: /\.(js|jsx|ts)$/,
          exclude: babelExclusionRule,
          loader: 'babel-loader',
          options: getBabelConfig(bundleType, packageType)
        }
      ]
    },
    plugins: [
      new EnvironmentPlugin(getWebpackEnv(mode)),
      new ProvidePlugin({
        process: 'process/browser'
      })
    ],
    ...(isEnvProduction
      ? {
          optimization: {
            minimize: true,
            minimizer: [
              new TerserPlugin({
                sourceMap: true,
                extractComments: true
              })
            ]
          }
        }
      : {})
  }
}