Skip to content

Commit

Permalink
chore: use minification for stats task and proper env (microsoft#13986)
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter committed Jul 10, 2020
1 parent 77a67dc commit 90ac821
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions scripts/webpack/webpack.config.stats.ts
Expand Up @@ -5,6 +5,7 @@ import webpack from 'webpack';
import config from '../config';
import glob from 'glob';
import * as _ from 'lodash';
import { argv } from 'yargs';
import TerserWebpackPlugin from 'terser-webpack-plugin';
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

Expand Down Expand Up @@ -59,31 +60,32 @@ const makeConfig = (srcPath: string, name: string): webpack.Configuration => ({
react: 'react',
'react-dom': 'reactDOM',
},
optimization: {
minimizer: [
new TerserWebpackPlugin({
cache: true,
parallel: true,
sourceMap: false,
...(argv.debug && {
optimization: {
minimizer: [
new TerserWebpackPlugin({
cache: true,
parallel: true,
sourceMap: false,

terserOptions: {
mangle: false,
output: {
beautify: true,
comments: true,
preserve_annotations: true,
terserOptions: {
mangle: false,
output: {
beautify: true,
comments: true,
preserve_annotations: true,
},
},
},
}),
],
},
}),
],
},
}),
plugins: [
new CleanWebpackPlugin([paths.base('stats')], {
root: paths.base(),
verbose: false, // do not log
}),
new IgnoreNotFoundExportPlugin(),
new webpack.DefinePlugin(config.compiler_globals),
// new BundleAnalyzerPlugin({
// reportFilename: `${name}.html`,
// analyzerMode: 'static',
Expand Down

0 comments on commit 90ac821

Please sign in to comment.