Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vite): 调整小程序的分chunks逻辑 #16156

Closed
wants to merge 14 commits into from
Prev Previous commit
Next Next commit
fix: 修复读取配置时缺少常量的注入
  • Loading branch information
liuzejia authored and liuzejia committed Jul 23, 2024
commit 79c2a9390ecf144c09d861296fed8c53fe4d0e9b
2 changes: 1 addition & 1 deletion packages/taro-vite-runner/src/utils/compiler/h5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class TaroCompilerContext extends CompilerContext<ViteH5BuildConfig> impl

const scriptPath = resolveMainFilePath(path.join(sourceDir, pageName), frameworkExts)
const configPath = this.getConfigFilePath(scriptPath)
const config: PageConfig = readConfig(configPath) || {}
const config: PageConfig = readConfig(configPath, this.taroConfig) || {}

const pageMeta = {
name: pageName,
Expand Down
6 changes: 3 additions & 3 deletions packages/taro-vite-runner/src/utils/compiler/harmony.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export class TaroCompilerContext extends CompilerContext<ViteHarmonyBuildConfig>
const defaultCommonChunks = ['runtime', 'vendors', 'taro', 'common']
let customCommonChunks: string[] = defaultCommonChunks
if (isFunction(commonChunks)) {
customCommonChunks = commonChunks(defaultCommonChunks.concat()) || defaultCommonChunks
} else if (isArray(commonChunks) && commonChunks.length) {
customCommonChunks = commonChunks
customCommonChunks = (commonChunks as ((commonChunks: string[]) => string[]))(defaultCommonChunks.concat()) || defaultCommonChunks
} else if (isArray(commonChunks) && commonChunks!.length) {
customCommonChunks = commonChunks as string[]
}
return customCommonChunks
}
Expand Down
8 changes: 4 additions & 4 deletions packages/taro-vite-runner/src/utils/compiler/mini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export class TaroCompilerContext extends CompilerContext<ViteMiniBuildConfig> im
const defaultCommonChunks = ['runtime', 'vendors', 'taro', 'common']
let customCommonChunks: string[] = defaultCommonChunks
if (isFunction(commonChunks)) {
customCommonChunks = commonChunks(defaultCommonChunks.concat()) || defaultCommonChunks
} else if (isArray(commonChunks) && commonChunks.length) {
customCommonChunks = commonChunks
customCommonChunks = (commonChunks as ((commonChunks: string[]) => string[]))(defaultCommonChunks.concat()) || defaultCommonChunks
} else if (isArray(commonChunks) && commonChunks!.length) {
customCommonChunks = commonChunks as string []
}
return customCommonChunks
}
Expand All @@ -65,7 +65,7 @@ export class TaroCompilerContext extends CompilerContext<ViteMiniBuildConfig> im
const configPath = isNative
? this.getConfigPath(scriptPath)
: this.getConfigFilePath(scriptPath)
const config: PageConfig = readConfig(configPath) || {}
const config: PageConfig = readConfig(configPath, this.taroConfig) || {}

const pageMeta = {
name: pageName,
Expand Down