chore: update webpack config
parent
dcb34b08e9
commit
b51f25fff7
|
@ -4,8 +4,9 @@ const path = require('path');
|
|||
const webpack = require('webpack');
|
||||
const WebpackBar = require('webpackbar');
|
||||
const { merge } = require('webpack-merge');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
||||
const CleanUpStatsPlugin = require('./utils/CleanUpStatsPlugin');
|
||||
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
|
@ -207,6 +208,9 @@ All rights reserved.
|
|||
}),
|
||||
new CleanUpStatsPlugin(),
|
||||
],
|
||||
performance: {
|
||||
hints: false,
|
||||
},
|
||||
};
|
||||
|
||||
if (process.env.RUN_ENV === 'PRODUCTION') {
|
||||
|
@ -223,17 +227,12 @@ All rights reserved.
|
|||
config.output.libraryTarget = 'umd';
|
||||
config.optimization = {
|
||||
minimizer: [
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
compiler => {
|
||||
return () => {
|
||||
return {
|
||||
new TerserPlugin({
|
||||
parallel: true,
|
||||
terserOptions: {
|
||||
warnings: false,
|
||||
},
|
||||
};
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -266,7 +265,8 @@ All rights reserved.
|
|||
}),
|
||||
],
|
||||
optimization: {
|
||||
minimizer: [new OptimizeCSSAssetsPlugin({})],
|
||||
minimize: true,
|
||||
minimizer: [new CssMinimizerPlugin({})],
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -308,11 +308,6 @@ function publish(tagString, done) {
|
|||
}
|
||||
|
||||
function pub(done) {
|
||||
dist(code => {
|
||||
if (code) {
|
||||
done(code);
|
||||
return;
|
||||
}
|
||||
const notOk = !packageJson.version.match(/^\d+\.\d+\.\d+$/);
|
||||
let tagString;
|
||||
if (argv['npm-tag']) {
|
||||
|
@ -332,37 +327,35 @@ function pub(done) {
|
|||
} else {
|
||||
publish(tagString, done);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
gulp.task(
|
||||
'compile-with-es',
|
||||
gulp.series(done => {
|
||||
compile(false).on('finish', function() {
|
||||
done();
|
||||
gulp.task('compile-with-es', done => {
|
||||
console.log('[Parallel] Compile to es...');
|
||||
compile(false).on('finish', done);
|
||||
});
|
||||
|
||||
gulp.task('compile-with-lib', done => {
|
||||
console.log('[Parallel] Compile to js...');
|
||||
compile().on('finish', done);
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
'compile',
|
||||
gulp.series('compile-with-es', done => {
|
||||
compile().on('finish', function() {
|
||||
gulp.series(gulp.parallel('compile-with-es', 'compile-with-lib'), done => {
|
||||
done();
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
'dist',
|
||||
gulp.series('compile', done => {
|
||||
gulp.series(done => {
|
||||
dist(done);
|
||||
}),
|
||||
);
|
||||
|
||||
gulp.task(
|
||||
'pub',
|
||||
gulp.series('check-git', 'compile', done => {
|
||||
gulp.series('check-git', 'compile', 'dist', done => {
|
||||
// if (!process.env.GITHUB_TOKEN) {
|
||||
// console.log('no GitHub token found, skip');
|
||||
// } else {
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"test:dev": "cross-env NODE_ENV=test jest --config .jest.js",
|
||||
"compile": "node antd-tools/cli/run.js compile",
|
||||
"generator-webtypes": "tsc -p antd-tools/generator-types/tsconfig.json && node antd-tools/generator-types/index.js",
|
||||
"pub": "node antd-tools/cli/run.js pub",
|
||||
"pub": "node --max_old_space_size=8192 antd-tools/cli/run.js pub",
|
||||
"pub-with-ci": "node antd-tools/cli/run.js pub-with-ci",
|
||||
"prepublish": "node antd-tools/cli/run.js guard",
|
||||
"pre-publish": "node ./scripts/prepub && npm run generator-webtypes",
|
||||
|
@ -112,6 +112,7 @@
|
|||
"compare-versions": "^3.3.0",
|
||||
"cross-env": "^7.0.0",
|
||||
"css-loader": "^5.0.0",
|
||||
"css-minimizer-webpack-plugin": "^2.0.0",
|
||||
"deep-assign": "^3.0.0",
|
||||
"docsearch.js": "^2.6.3",
|
||||
"enquire-js": "^0.2.1",
|
||||
|
@ -151,7 +152,6 @@
|
|||
"mkdirp": "^0.5.1",
|
||||
"mockdate": "^2.0.2",
|
||||
"nprogress": "^0.2.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||
"postcss": "^8.2.12",
|
||||
"postcss-loader": "^5.0.0",
|
||||
"prettier": "^1.18.2",
|
||||
|
@ -171,6 +171,7 @@
|
|||
"stylelint-config-standard": "^22.0.0",
|
||||
"stylelint-declaration-block-no-ignored-properties": "^2.1.0",
|
||||
"stylelint-order": "^4.0.0",
|
||||
"terser-webpack-plugin": "^5.1.1",
|
||||
"through2": "^3.0.0",
|
||||
"ts-jest": "^26.4.1",
|
||||
"ts-loader": "^9.1.0",
|
||||
|
|
Loading…
Reference in New Issue