Skip to content

Commit

Permalink
docs: 升级 dumi-theme-logicflow 包为 0.0.19,将 @babel/standalone 按需加载
Browse files Browse the repository at this point in the history
  • Loading branch information
boyongjiong committed Aug 19, 2024
1 parent 9defa6a commit 45b6a7c
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 22 deletions.
115 changes: 106 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 53 additions & 10 deletions sites/docs/.dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { defineConfig } from 'dumi';
import { repository, version } from './package.json';
import CompressionPlugin from 'compression-webpack-plugin';
import * as process from 'node:process';

export default defineConfig({
locales: [
Expand Down Expand Up @@ -399,8 +401,8 @@ export default defineConfig({
},
},
},
mfsu: false,
// mako: {},
// mako: {}, // 开启 mako 打包,目前会导致 Examples 模块不可用,暂时关闭,恢复至 webpack 打包
mfsu: {},
alias: {
'@': __dirname,
},
Expand All @@ -412,12 +414,53 @@ export default defineConfig({
javascriptEnabled: true,
},
},
// codeSplitting: { jsStrategy: 'granularChunks' },
// chainWebpack: (config) => {
// // 打开 bundle 分析器
// config
// .plugin('webpack-bundle-analyzer')
// .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin);
// return config;
// },
extraBabelPlugins: [
[
'import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
],
// 下面的 @ant-design/icons 和 lodash-es 需要按需加载,但目前看来不起作用(或者是起作用了,就那么大。需要确认下)
[
'import',
{
libraryName: '@ant-design/icons',
libraryDirectory: 'es/icons', // 指定图标路径
camel2DashComponentName: false, // 禁用驼峰转换
},
'@ant-design/icons',
],
// [
// 'import',
// {
// libraryName: 'lodash-es',
// libraryDirectory: '',
// camel2DashComponentName: false
// }, 'lodash-es'
// ]
],
codeSplitting: { jsStrategy: 'granularChunks' },
chainWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
// 设置资源 gzip 压缩
config.plugin('compression-webpack-plugin').use(CompressionPlugin, [
{
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/, // 匹配文件名
threshold: 10240, // 对超过 10K 的数据压缩
deleteOriginalAssets: false, // 不删除源文件
},
]);

// 打开 bundle 分析器
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin);
}

return config;
},
});
Loading

0 comments on commit 45b6a7c

Please sign in to comment.