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