diff --git a/manifest.config.ts b/manifest.config.ts index 50c2dc3..46d3876 100644 --- a/manifest.config.ts +++ b/manifest.config.ts @@ -135,6 +135,9 @@ export default defineManifestConfig({ 'mp-alipay': { usingComponents: true, styleIsolation: 'shared', + optimization: { + subPackages: true, + }, }, 'mp-baidu': { usingComponents: true, diff --git a/tsconfig.json b/tsconfig.json index 0b55344..3696728 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,8 @@ "miniprogram-api-typings", "wot-design-uni/global.d.ts", "z-paging/types", + "./src/types/async-component.d.ts", + "./src/types/async-import.d.ts", "./src/typings.d.ts" ], "allowJs": true, diff --git a/vite.config.ts b/vite.config.ts index f75c7c1..cbfbc14 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -70,6 +70,18 @@ export default defineConfig(({ command, mode }) => { UniLayouts(), UniPlatform(), UniManifest(), + // Optimization 插件需要 page.json 文件,故应在 UniPages 插件之后执行 + Optimization({ + enable: { + 'optimization': true, + 'async-import': true, + 'async-component': true, + }, + dts: { + base: 'src/types', + }, + logger: true, + }), // UniXXX 需要在 Uni 之前引入 { // 临时解决 dcloudio 官方的 @dcloudio/uni-mp-compiler 出现的编译 BUG @@ -90,19 +102,6 @@ export default defineConfig(({ command, mode }) => { dirs: ['src/hooks'], // 自动导入 hooks vueTemplate: true, // default false }), - // Optimization 插件需要 page.json 文件,故应在 UniPages 插件之后执行 - Optimization({ - enable: { - 'optimization': true, - 'async-import': true, - 'async-component': true, - }, - dts: { - base: 'src/types', - }, - logger: false, - }), - ViteRestart({ // 通过这个插件,在修改vite.config.js文件则不需要重新运行也生效配置 restart: ['vite.config.js'],