feat(optimization): 添加分包优化和异步组件支持,更新相关配置
This commit is contained in:
@@ -135,6 +135,9 @@ export default defineManifestConfig({
|
||||
'mp-alipay': {
|
||||
usingComponents: true,
|
||||
styleIsolation: 'shared',
|
||||
optimization: {
|
||||
subPackages: true,
|
||||
},
|
||||
},
|
||||
'mp-baidu': {
|
||||
usingComponents: true,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user