mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
Merge pull request #33045 from ant-design/opt-theme
chore: Speed up site build preview speed
This commit is contained in:
commit
90bfbe2a62
2
.github/workflows/preview-build.yml
vendored
2
.github/workflows/preview-build.yml
vendored
@ -64,6 +64,8 @@ jobs:
|
||||
- name: npm run site
|
||||
id: site
|
||||
run: npm run site
|
||||
env:
|
||||
SITE_ENV: development
|
||||
|
||||
- name: upload site artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
|
@ -84,9 +84,9 @@
|
||||
"pub": "npm run version && antd-tools run pub",
|
||||
"prepublishOnly": "antd-tools run guard",
|
||||
"site:theme": "npm run site:theme-dark && npm run site:theme-compact",
|
||||
"site:theme-dark": "cross-env ESBUILD=1 ANT_THEME=dark bisheng build --ssr -c ./site/bisheng.config.js",
|
||||
"site:theme-compact": "cross-env ESBUILD=1 ANT_THEME=compact bisheng build --ssr -c ./site/bisheng.config.js",
|
||||
"site": "npm run site:theme && cross-env NODE_ICU_DATA=node_modules/full-icu ESBUILD=1 concurrently \"bisheng build --ssr -c ./site/bisheng.config.js\"",
|
||||
"site:theme-dark": "cross-env ESBUILD=1 ANT_THEME=dark bisheng build -c ./site/bisheng.config.js",
|
||||
"site:theme-compact": "cross-env ESBUILD=1 ANT_THEME=compact bisheng build -c ./site/bisheng.config.js",
|
||||
"site": "npm run site:theme && cross-env NODE_ICU_DATA=node_modules/full-icu ESBUILD=1 bisheng build --ssr -c ./site/bisheng.config.js",
|
||||
"sort": "npx sort-package-json",
|
||||
"sort-api": "antd-tools run sort-api-table",
|
||||
"start": "antd-tools run clean && cross-env NODE_ENV=development concurrently \"bisheng start -c ./site/bisheng.config.js\"",
|
||||
|
@ -111,6 +111,13 @@ module.exports = {
|
||||
|
||||
delete config.module.noParse;
|
||||
|
||||
// Use dev mod to speed up site preview build
|
||||
// This is used for CI preview build in `preview-build.yml`
|
||||
if (process.env.SITE_ENV === 'development') {
|
||||
console.log('Site build with development mode...');
|
||||
config.mode = 'development';
|
||||
}
|
||||
|
||||
if (ANT_THEME) {
|
||||
config.mode = 'development';
|
||||
config.plugins.forEach(plugin => {
|
||||
@ -119,6 +126,37 @@ module.exports = {
|
||||
plugin.options.filename = `${ANT_THEME}.css`;
|
||||
}
|
||||
});
|
||||
|
||||
// Remove preset target
|
||||
config.module.rules.forEach(rule => {
|
||||
if (rule.options?.presets?.[1]?.[0]?.includes('preset-env')) {
|
||||
delete rule.options.presets[1][1];
|
||||
delete rule.options.plugins;
|
||||
}
|
||||
});
|
||||
|
||||
config.optimization.minimize = false;
|
||||
delete config.optimization.minimizer;
|
||||
|
||||
config.externals = [
|
||||
/^rc-.*/,
|
||||
/^react.*/,
|
||||
/^@ant-design\/.*/,
|
||||
/^@babel\/.*/,
|
||||
/^@algolia\/.*/,
|
||||
/^@docsearch\/.*/,
|
||||
/autocomplete.js/,
|
||||
/docsearch.js/,
|
||||
/.*\.md/,
|
||||
/lodash/,
|
||||
/jquery/,
|
||||
/moment/,
|
||||
/core-js/,
|
||||
/jsonml/,
|
||||
/ramda/,
|
||||
/tinycolor/,
|
||||
/bisheng-plugin/,
|
||||
];
|
||||
}
|
||||
|
||||
return config;
|
||||
|
Loading…
Reference in New Issue
Block a user