weapp-vite 6.16.0 → 6.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost-SJdl15d3.mjs";
2
2
  import { n as configureLogger, r as logger_default } from "./logger-CgxdNjvb.mjs";
3
- import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-BC_RNbAI.mjs";
3
+ import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-Dnwa6tm_.mjs";
4
4
  import { createRequire, isBuiltin } from "node:module";
5
5
  import path, { posix } from "pathe";
6
6
  import path$1, { normalize, relative, win32 } from "node:path";
@@ -8748,7 +8748,7 @@ const REQUEST_GLOBAL_EXPORT_RE = /Object\.defineProperty\(exports,\s*(?:`([^`]+)
8748
8748
  const REQUEST_GLOBAL_INSTALLER_RE = /function\s+([A-Za-z_$][\w$]*)\([^)]*=\{\}\)\{[\s\S]{0,220}?targets\?\?\[[\s\S]{0,80}?fetch[\s\S]{0,80}?Headers[\s\S]{0,80}?Request[\s\S]{0,80}?Response[\s\S]{0,80}?AbortController[\s\S]{0,80}?AbortSignal[\s\S]{0,80}?XMLHttpRequest[\s\S]{0,80}?WebSocket[\s\S]{0,260}?return [^}]+\}/;
8749
8749
  const REQUEST_GLOBAL_ENTRY_NAME_RE = /\.[^/.]+$/;
8750
8750
  const REQUEST_GLOBAL_REQUIRE_DECLARATOR_RE = /([A-Za-z_$][\w$]*)\s*=\s*require\((`([^`]+)`|'([^']+)'|"([^"]+)")\)/g;
8751
- const REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME = "request-globals-runtime.js";
8751
+ const REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME = "weapp-vendors/request-globals-runtime.js";
8752
8752
  const DYNAMIC_GLOBAL_RESOLUTION_RE = /Function\(\s*(?:`return this`|'return this'|"return this")\s*\)\(\)/g;
8753
8753
  const BROWSER_GLOBAL_HOST_TERNARY_RE = /typeof self<[`'"]u[`'"]\?self:typeof window<[`'"]u[`'"]\?window:globalThis/g;
8754
8754
  const AXIOS_MODULE_ID_RE = /[/\\](?:\.pnpm[/\\][^/\\]+[/\\]node_modules[/\\])?axios[/\\]/u;
@@ -9891,6 +9891,12 @@ function resolveDistChunkPackageToken(cleanedAbsoluteId) {
9891
9891
  if (!packageToken) return;
9892
9892
  return sanitizePackageToken(packageToken);
9893
9893
  }
9894
+ function isRequestGlobalsRuntimeModuleId(id) {
9895
+ const cleanedAbsoluteId = normalizeSharedPathCandidate(id);
9896
+ REG_REQUEST_GLOBAL_RUNTIME_VENDOR_ID.lastIndex = 0;
9897
+ if (REG_REQUEST_GLOBAL_RUNTIME_VENDOR_ID.test(cleanedAbsoluteId)) return true;
9898
+ return resolveDistChunkPackageToken(cleanedAbsoluteId)?.endsWith("web-apis") === true;
9899
+ }
9894
9900
  function resolveStableHashedDistChunkFileName(chunk) {
9895
9901
  const candidateIds = [chunk.facadeModuleId, ...chunk.moduleIds ?? []].filter((id) => typeof id === "string");
9896
9902
  for (const id of candidateIds) {
@@ -9902,7 +9908,7 @@ function resolveStableHashedDistChunkFileName(chunk) {
9902
9908
  const packageToken = resolveDistChunkPackageToken(cleanedAbsoluteId);
9903
9909
  if (!baseName || !packageToken) continue;
9904
9910
  REG_REQUEST_GLOBAL_RUNTIME_VENDOR_ID.lastIndex = 0;
9905
- if (REG_REQUEST_GLOBAL_RUNTIME_VENDOR_ID.test(cleanedAbsoluteId) || packageToken.endsWith("web-apis")) return `request-globals-${packageToken}-${baseName}.js`;
9911
+ if (REG_REQUEST_GLOBAL_RUNTIME_VENDOR_ID.test(cleanedAbsoluteId) || packageToken.endsWith("web-apis")) return `weapp-vendors/request-globals-${packageToken}-${baseName}.js`;
9906
9912
  return `weapp-vendors/${packageToken}-${baseName}.js`;
9907
9913
  }
9908
9914
  }
@@ -9913,7 +9919,7 @@ function createSharedBuildResolver(configService, getSubPackageRoots) {
9913
9919
  const forceDuplicateTester = createForceDuplicateTester(forceDuplicatePatterns);
9914
9920
  const resolveSharedMode = createSharedModeResolver(sharedMode, sharedOverrides);
9915
9921
  const resolveSharedPath = createSharedPathResolver(configService, sharedPathRoot);
9916
- return { resolveAdvancedChunkName: createAdvancedChunkNameResolver({
9922
+ const resolveAdvancedChunkName = createAdvancedChunkNameResolver({
9917
9923
  vendorsMatchers: [nodeModulesDeps, commonjsHelpersDeps],
9918
9924
  relativeAbsoluteSrcRoot: configService.relativeAbsoluteSrcRoot,
9919
9925
  getSubPackageRoots,
@@ -9922,12 +9928,18 @@ function createSharedBuildResolver(configService, getSubPackageRoots) {
9922
9928
  sharedMode,
9923
9929
  resolveSharedMode,
9924
9930
  resolveSharedPath
9925
- }) };
9931
+ });
9932
+ const resolveSharedBuildChunkName = (id, ctx) => {
9933
+ if (isRequestGlobalsRuntimeModuleId(id)) return REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME.replace(/\.js$/, "");
9934
+ return resolveAdvancedChunkName(id, ctx);
9935
+ };
9936
+ return { resolveAdvancedChunkName: resolveSharedBuildChunkName };
9926
9937
  }
9927
9938
  function createSharedBuildOutput(configService, getSubPackageRoots) {
9928
9939
  const { resolveAdvancedChunkName } = createSharedBuildResolver(configService, getSubPackageRoots);
9929
9940
  return {
9930
9941
  codeSplitting: { groups: [{ name: (id, ctx) => resolveAdvancedChunkName(id, ctx) }] },
9942
+ minifyInternalExports: false,
9931
9943
  chunkFileNames: (chunk) => {
9932
9944
  if (isRequestGlobalsRuntimeChunk(chunk)) return REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME;
9933
9945
  const stableHashedDistChunkFileName = resolveStableHashedDistChunkFileName(chunk);
@@ -11132,6 +11144,20 @@ function getWeappViteConfig() {
11132
11144
  multiPlatform: false,
11133
11145
  es5: false,
11134
11146
  packageSizeWarningBytes: 2 * 1024 * 1024,
11147
+ analyze: {
11148
+ budgets: {
11149
+ totalBytes: 20 * 1024 * 1024,
11150
+ mainBytes: 2 * 1024 * 1024,
11151
+ subPackageBytes: 2 * 1024 * 1024,
11152
+ independentBytes: 2 * 1024 * 1024,
11153
+ warningRatio: .85
11154
+ },
11155
+ history: {
11156
+ enabled: true,
11157
+ dir: ".weapp-vite/analyze-history",
11158
+ limit: 20
11159
+ }
11160
+ },
11135
11161
  jsFormat: "cjs",
11136
11162
  isAdditionalWxml: () => {
11137
11163
  return false;
@@ -12646,14 +12672,29 @@ function createExtendedLibManager() {
12646
12672
  }
12647
12673
  //#endregion
12648
12674
  //#region src/plugins/hooks/useLoadEntry/jsonEmit.ts
12675
+ function normalizeAppJson(json) {
12676
+ if (!json || typeof json !== "object" || Array.isArray(json)) return json;
12677
+ const subPackages = Array.isArray(json.subPackages) ? json.subPackages : Array.isArray(json.subpackages) ? json.subpackages : [];
12678
+ return {
12679
+ ...json,
12680
+ subPackages: subPackages.map((subPackage) => ({
12681
+ ...subPackage,
12682
+ pages: Array.isArray(subPackage?.pages) ? subPackage.pages : []
12683
+ }))
12684
+ };
12685
+ }
12649
12686
  function createJsonEmitManager(configService) {
12650
12687
  const map = /* @__PURE__ */ new Map();
12651
12688
  function register(entry) {
12652
12689
  if (!entry.jsonPath) return;
12653
12690
  const fileName = resolveRelativeJsonOutputFileName(configService, entry.jsonPath);
12691
+ const normalizedEntry = entry.type === "app" && fileName === "app.json" ? {
12692
+ ...entry,
12693
+ json: normalizeAppJson(entry.json)
12694
+ } : entry;
12654
12695
  map.set(fileName, {
12655
12696
  fileName,
12656
- entry
12697
+ entry: normalizedEntry
12657
12698
  });
12658
12699
  }
12659
12700
  return {
@@ -14468,6 +14509,7 @@ async function applyScriptSetupUsingComponents(options) {
14468
14509
  }
14469
14510
  //#endregion
14470
14511
  //#region src/plugins/hooks/useLoadEntry/loadEntry/index.ts
14512
+ const VUE_LIKE_PAGE_ENTRY_RE = /\.(?:vue|jsx|tsx)$/;
14471
14513
  function createStopwatch() {
14472
14514
  const start = performance$1.now();
14473
14515
  return () => `${(performance$1.now() - start).toFixed(2)}ms`;
@@ -14549,6 +14591,32 @@ function createEntryLoader(options) {
14549
14591
  let shouldSkipAppEntries = false;
14550
14592
  const nativeLayoutScriptEntries = /* @__PURE__ */ new Set();
14551
14593
  const autoRoutesSignature = configService.isDev ? ctx.autoRoutesService?.getSignature?.() : void 0;
14594
+ const registerPageLayoutComponentEntries = async (layoutPlan, options) => {
14595
+ if (options?.trackLayoutDependencies) {
14596
+ const layoutDependencies = /* @__PURE__ */ new Set();
14597
+ for (const file of await expandResolvedPageLayoutFiles(layoutPlan.layouts)) layoutDependencies.add(normalizeFsResolvedId(file));
14598
+ replaceLayoutDependencies(normalizedId, layoutDependencies);
14599
+ }
14600
+ await addResolvedPageLayoutWatchFiles(this, layoutPlan.layouts);
14601
+ await registerResolvedPageLayoutEntries({
14602
+ layouts: layoutPlan.layouts,
14603
+ entries,
14604
+ explicitEntryTypes,
14605
+ nativeScriptEntries: nativeLayoutScriptEntries,
14606
+ normalizeEntry,
14607
+ jsonPath
14608
+ });
14609
+ for (const layout of layoutPlan.layouts) {
14610
+ if (layout.kind === "native") continue;
14611
+ if (!layout.file.endsWith(".vue")) continue;
14612
+ if (!await shouldEmitScriptlessVueLayoutJs$1(layout.file)) continue;
14613
+ const relativeLayoutBase = configService.relativeOutputPath(removeExtensionDeep(layout.file));
14614
+ if (!relativeLayoutBase || emittedScriptlessVueLayoutJs.has(relativeLayoutBase)) continue;
14615
+ emittedScriptlessVueLayoutJs.add(relativeLayoutBase);
14616
+ const { scriptExtension } = resolveCompilerOutputExtensions(configService.outputExtensions);
14617
+ emitScriptlessComponentAsset(this, resolveScriptlessComponentFileName(relativeLayoutBase, scriptExtension));
14618
+ }
14619
+ };
14552
14620
  if (type === "app") {
14553
14621
  appResult = await collectAppEntries({
14554
14622
  pluginCtx: this,
@@ -14614,34 +14682,13 @@ function createEntryLoader(options) {
14614
14682
  if (vueSource) {
14615
14683
  const layoutPlan = await resolvePageLayoutPlan(vueSource, vueEntryPath, configService);
14616
14684
  replaceLayoutDependencies(normalizedId, []);
14617
- if (layoutPlan) {
14618
- if (vueSource.includes("definePageMeta") || vueSource.includes("setPageLayout")) {
14619
- const layoutDependencies = /* @__PURE__ */ new Set();
14620
- for (const file of await expandResolvedPageLayoutFiles(layoutPlan.layouts)) layoutDependencies.add(normalizeFsResolvedId(file));
14621
- replaceLayoutDependencies(normalizedId, layoutDependencies);
14622
- }
14623
- await addResolvedPageLayoutWatchFiles(this, layoutPlan.layouts);
14624
- await registerResolvedPageLayoutEntries({
14625
- layouts: layoutPlan.layouts,
14626
- entries,
14627
- explicitEntryTypes,
14628
- nativeScriptEntries: nativeLayoutScriptEntries,
14629
- normalizeEntry,
14630
- jsonPath
14631
- });
14632
- for (const layout of layoutPlan.layouts) {
14633
- if (layout.kind === "native") continue;
14634
- if (!layout.file.endsWith(".vue")) continue;
14635
- if (!await shouldEmitScriptlessVueLayoutJs$1(layout.file)) continue;
14636
- const relativeLayoutBase = configService.relativeOutputPath(removeExtensionDeep(layout.file));
14637
- if (!relativeLayoutBase || emittedScriptlessVueLayoutJs.has(relativeLayoutBase)) continue;
14638
- emittedScriptlessVueLayoutJs.add(relativeLayoutBase);
14639
- const { scriptExtension } = resolveCompilerOutputExtensions(configService.outputExtensions);
14640
- emitScriptlessComponentAsset(this, resolveScriptlessComponentFileName(relativeLayoutBase, scriptExtension));
14641
- }
14642
- }
14685
+ if (layoutPlan) await registerPageLayoutComponentEntries(layoutPlan, { trackLayoutDependencies: vueSource.includes("definePageMeta") || vueSource.includes("setPageLayout") });
14643
14686
  }
14644
14687
  }
14688
+ } else if (type === "page" && templatePath && !VUE_LIKE_PAGE_ENTRY_RE.test(id)) {
14689
+ replaceLayoutDependencies(normalizedId, []);
14690
+ const layoutPlan = await resolvePageLayoutPlan(await fs.readFile(id, "utf-8"), id, configService);
14691
+ if (layoutPlan) await registerPageLayoutComponentEntries(layoutPlan, { trackLayoutDependencies: true });
14645
14692
  }
14646
14693
  if (configService.isDev && hasJsonEntry && vueEntryPath) {
14647
14694
  const vueSource = await readVueSource();
@@ -14757,8 +14804,6 @@ function createTemplateScanner(wxmlService, debug) {
14757
14804
  }
14758
14805
  //#endregion
14759
14806
  //#region src/plugins/hooks/useLoadEntry/index.ts
14760
- const MAX_DIRECT_SOURCE_SHARED_CHUNK_IMPORTERS = 128;
14761
- const MAX_FALLBACK_DIRECT_SOURCE_SHARED_CHUNK_IMPORTERS = 8;
14762
14807
  function resolveUpstreamPendingReasonSummary(dirtyReasonSummary) {
14763
14808
  if (!dirtyReasonSummary?.length) return [];
14764
14809
  const pendingReasonSummary = [];
@@ -14770,12 +14815,6 @@ function resolveUpstreamPendingReasonSummary(dirtyReasonSummary) {
14770
14815
  if (hasAutoRoutesTopology) pendingReasonSummary.push("auto-routes-topology");
14771
14816
  return pendingReasonSummary;
14772
14817
  }
14773
- function isDirectSourceSharedChunkForEntry(options) {
14774
- if (options.sourceSharedChunks?.has(options.chunkId) !== true) return false;
14775
- const normalizedEntryId = normalizeFsResolvedId(options.entryId);
14776
- if ((options.entryLayoutDependencies?.get(normalizedEntryId))?.size) return true;
14777
- return options.importerCount <= MAX_FALLBACK_DIRECT_SOURCE_SHARED_CHUNK_IMPORTERS;
14778
- }
14779
14818
  function resolvePendingEntryIds(options) {
14780
14819
  const pending = new Set(options.dirtyEntrySet);
14781
14820
  const pendingReasonSummary = resolveUpstreamPendingReasonSummary(options.dirtyReasonSummary);
@@ -14817,17 +14856,9 @@ function resolvePendingEntryIds(options) {
14817
14856
  hasDependencyDrivenImporter = true;
14818
14857
  continue;
14819
14858
  }
14820
- if (options.dirtyEntrySet.has(importer) && options.dirtyEntryReasons.get(importer) === "direct") {
14821
- if (isDirectSourceSharedChunkForEntry({
14822
- chunkId,
14823
- entryId: importer,
14824
- sourceSharedChunks: options.sourceSharedChunks,
14825
- entryLayoutDependencies: options.entryLayoutDependencies,
14826
- importerCount: importers.size
14827
- })) hasDirectDirtyImporter = true;
14828
- }
14859
+ if (options.dirtyEntrySet.has(importer) && options.dirtyEntryReasons.get(importer) === "direct") hasDirectDirtyImporter = true;
14829
14860
  }
14830
- if (!hasDependencyDrivenImporter && !(hasDirectDirtyImporter && importers.size <= MAX_DIRECT_SOURCE_SHARED_CHUNK_IMPORTERS)) continue;
14861
+ if (!hasDependencyDrivenImporter && !hasDirectDirtyImporter) continue;
14831
14862
  if (hasDependencyDrivenImporter && hasDirectDirtyImporter) expansionMode = "mixed";
14832
14863
  else if (hasDirectDirtyImporter) expansionMode = expansionMode && expansionMode !== "direct" ? "mixed" : "direct";
14833
14864
  else expansionMode = expansionMode && expansionMode !== "dependency" ? "mixed" : "dependency";
@@ -14907,7 +14938,6 @@ function useLoadEntry(ctx, options) {
14907
14938
  const hmrSharedChunksMode = options?.hmr?.sharedChunks ?? "auto";
14908
14939
  const hmrSharedChunkImporters = options?.hmr?.sharedChunkImporters;
14909
14940
  const hmrSharedChunksByEntry = options?.hmr?.sharedChunksByEntry;
14910
- const hmrSourceSharedChunks = options?.hmr?.sourceSharedChunks;
14911
14941
  return {
14912
14942
  loadEntry,
14913
14943
  entriesMap,
@@ -14940,11 +14970,7 @@ function useLoadEntry(ctx, options) {
14940
14970
  dirtyEntryReasons,
14941
14971
  dirtyReasonSummary: ctx.runtimeState.build.hmr.profile.dirtyReasonSummary,
14942
14972
  sharedChunkImporters: hmrSharedChunkImporters,
14943
- sharedChunksByEntry: hmrSharedChunksByEntry,
14944
- sourceSharedChunks: hmrSourceSharedChunks,
14945
- entryLayoutDependencies,
14946
- subPackageRoots: new Set(ctx.scanService?.subPackageMap?.keys?.() ?? []),
14947
- relativeAbsoluteSrcRoot: ctx.configService.relativeAbsoluteSrcRoot.bind(ctx.configService)
14973
+ sharedChunksByEntry: hmrSharedChunksByEntry
14948
14974
  });
14949
14975
  const pendingEntryIds = pendingResolution.pending;
14950
14976
  const pending = [];
@@ -16186,9 +16212,26 @@ function rewriteJsonNpmImportsToLocalRoot(bundle, root, dependencyPatterns, depe
16186
16212
  }
16187
16213
  //#endregion
16188
16214
  //#region src/plugins/core/lifecycle/emit/requestGlobals.ts
16215
+ const REQUEST_GLOBAL_REQUIRE_CALL_RE = /require\((`([^`]+)`|'([^']+)'|"([^"]+)")\)/g;
16216
+ const REQUEST_GLOBAL_APP_MODULE_KEY_PREFIX = "__weappViteRequestGlobalsModule:";
16189
16217
  function resolveChunkRequestGlobalsTargets(code, targets, mode) {
16190
16218
  return mode === "auto" ? resolveAutoRequestGlobalsTargets(code, targets) : targets;
16191
16219
  }
16220
+ function collectTopLevelDeclaredIdentifiers(code) {
16221
+ const identifiers = /* @__PURE__ */ new Set();
16222
+ try {
16223
+ const body = parseJsLike(code)?.program?.body;
16224
+ if (!Array.isArray(body)) return identifiers;
16225
+ for (const statement of body) {
16226
+ if ((statement?.type === "FunctionDeclaration" || statement?.type === "ClassDeclaration") && statement.id?.type === "Identifier") identifiers.add(statement.id.name);
16227
+ if (statement?.type !== "VariableDeclaration") continue;
16228
+ for (const declaration of statement.declarations ?? []) if (declaration?.id?.type === "Identifier") identifiers.add(declaration.id.name);
16229
+ }
16230
+ } catch {
16231
+ return identifiers;
16232
+ }
16233
+ return identifiers;
16234
+ }
16192
16235
  function resolveRequestGlobalsInstallerName(code) {
16193
16236
  const installerMatch = code.match(REQUEST_GLOBAL_INSTALLER_RE);
16194
16237
  if (installerMatch?.[1]) return installerMatch[1];
@@ -16267,14 +16310,15 @@ function injectRequestGlobalsBundleRuntime(bundle, targets, mode, networkDefault
16267
16310
  if (chunkTargets.length === 0) continue;
16268
16311
  const bindingTargets = resolveRequestGlobalsBindingTargets(chunkTargets);
16269
16312
  if (bindingTargets.length === 0) continue;
16270
- const passiveBindingsCode = createRequestGlobalsPassiveBindingsCode(chunkTargets, bindingTargets);
16313
+ const topLevelDeclaredIdentifiers = collectTopLevelDeclaredIdentifiers(chunk.code);
16314
+ const passiveBindingsCode = createRequestGlobalsPassiveBindingsCode(chunkTargets, bindingTargets.filter((target) => !topLevelDeclaredIdentifiers.has(target)));
16271
16315
  const syntheticExportCode = exportName ? "" : `Object.defineProperty(exports,${JSON.stringify(REQUEST_GLOBAL_SYNTHETIC_EXPORT_NAME)},{enumerable:false,get:function(){return ${installerName}}});`;
16272
16316
  const runtimeBindingCode = [
16273
16317
  `const ${REQUEST_GLOBAL_BUNDLE_HOST_REF} = ${installerName}(${createRequestGlobalsInstallerOptionsCode(chunkTargets, networkDefaults)}) || globalThis`,
16274
16318
  ...bindingTargets.map((target) => `${REQUEST_GLOBAL_ACTUALS_KEY}[${JSON.stringify(target)}] = ${REQUEST_GLOBAL_BUNDLE_HOST_REF}.${target}`),
16275
16319
  ...bindingTargets.map((target) => `try{globalThis[${JSON.stringify(target)}]=${REQUEST_GLOBAL_BUNDLE_HOST_REF}.${target}}catch{}`)
16276
16320
  ].join(";");
16277
- const bundlePrelude = `/* ${REQUEST_GLOBAL_BUNDLE_MARKER} */ ${passiveBindingsCode}\n`;
16321
+ const bundlePrelude = `/* ${REQUEST_GLOBAL_BUNDLE_MARKER} */ ${passiveBindingsCode ? `${passiveBindingsCode}\n` : ""}`;
16278
16322
  const firstRequireMatch = chunk.code.match(REQUEST_GLOBAL_REQUIRE_DECLARATOR_RE);
16279
16323
  if (firstRequireMatch?.[0]) {
16280
16324
  chunk.code = `${bundlePrelude}${chunk.code.replace(firstRequireMatch[0], (match) => `${match};${syntheticExportCode}${runtimeBindingCode}`)}\n`;
@@ -16398,6 +16442,102 @@ function rewriteChunkRequireLiteral(chunk, fromFileName, toFileName) {
16398
16442
  });
16399
16443
  if (didRewrite) chunk.code = nextCode;
16400
16444
  }
16445
+ function hasBareRequireRegistration(code, requirePath) {
16446
+ const escapedRequireLiteral = JSON.stringify(requirePath).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16447
+ return new RegExp(`(?:^|[;\\n])\\s*require\\(${escapedRequireLiteral}\\);`).test(code);
16448
+ }
16449
+ function getRequireCallImportee(args) {
16450
+ return args[2] ?? args[3] ?? args[4];
16451
+ }
16452
+ function rewriteRequireCallLiterals(code, rewrite) {
16453
+ return code.replaceAll(REQUEST_GLOBAL_REQUIRE_CALL_RE, (...args) => {
16454
+ const match = args[0];
16455
+ const requireLiteral = args[1];
16456
+ const importee = getRequireCallImportee(args);
16457
+ if (typeof importee !== "string") return match;
16458
+ return rewrite(requireLiteral, importee) ?? match;
16459
+ });
16460
+ }
16461
+ function rewriteEmbeddedRequirePaths(code, fromFileName, toFileName) {
16462
+ return rewriteRequireCallLiterals(code, (_requireLiteral, importee) => {
16463
+ const resolvedImport = normalizeRelativeChunkImport(fromFileName, importee);
16464
+ return `require(${JSON.stringify(toRequireRequestPath(toFileName, resolvedImport))})`;
16465
+ });
16466
+ }
16467
+ function rewriteChunkRequireCallsToExpression(chunk, targetFileName, expression) {
16468
+ let didRewrite = false;
16469
+ const nextCode = rewriteRequireCallLiterals(chunk.code, (_requireLiteral, importee) => {
16470
+ if (normalizeRelativeChunkImport(chunk.fileName, importee) !== targetFileName) return;
16471
+ didRewrite = true;
16472
+ return expression;
16473
+ });
16474
+ if (didRewrite) chunk.code = nextCode;
16475
+ return didRewrite;
16476
+ }
16477
+ function createRequestGlobalsStaticImportReplacement(node, expression) {
16478
+ const declarations = [];
16479
+ const namedSpecifiers = [];
16480
+ for (const specifier of node.specifiers ?? []) {
16481
+ if (specifier?.type === "ImportNamespaceSpecifier" && specifier.local?.type === "Identifier") {
16482
+ declarations.push(`const ${specifier.local.name} = ${expression};`);
16483
+ continue;
16484
+ }
16485
+ if (specifier?.type === "ImportDefaultSpecifier" && specifier.local?.type === "Identifier") {
16486
+ declarations.push(`const ${specifier.local.name} = ${expression}.default;`);
16487
+ continue;
16488
+ }
16489
+ if (specifier?.type !== "ImportSpecifier" || specifier.local?.type !== "Identifier") continue;
16490
+ const importedName = specifier.imported?.type === "Identifier" ? specifier.imported.name : getStaticStringLiteral(specifier.imported);
16491
+ if (!importedName) continue;
16492
+ const propertyName = /^[_a-z]\w*$/i.test(importedName) ? importedName : JSON.stringify(importedName);
16493
+ namedSpecifiers.push(specifier.local.name === importedName && propertyName === importedName ? importedName : `${propertyName}: ${specifier.local.name}`);
16494
+ }
16495
+ if (namedSpecifiers.length > 0) declarations.unshift(`const { ${namedSpecifiers.join(", ")} } = ${expression};`);
16496
+ return declarations.length > 0 ? declarations.join("\n") : `${expression};`;
16497
+ }
16498
+ function rewriteChunkStaticImportsToExpression(chunk, targetFileName, expression) {
16499
+ try {
16500
+ const ast = parseJsLike(chunk.code);
16501
+ const replacements = [];
16502
+ traverse(ast, { ImportDeclaration(path) {
16503
+ const importee = getStaticStringLiteral(path.node?.source);
16504
+ if (!importee) return;
16505
+ if (normalizeRelativeChunkImport(chunk.fileName, importee) !== targetFileName) return;
16506
+ if (typeof path.node.start !== "number" || typeof path.node.end !== "number") return;
16507
+ replacements.push({
16508
+ end: path.node.end,
16509
+ start: path.node.start,
16510
+ value: createRequestGlobalsStaticImportReplacement(path.node, expression)
16511
+ });
16512
+ } });
16513
+ if (replacements.length === 0) return false;
16514
+ let nextCode = chunk.code;
16515
+ for (const replacement of replacements.sort((left, right) => right.start - left.start)) nextCode = `${nextCode.slice(0, replacement.start)}${replacement.value}${nextCode.slice(replacement.end)}`;
16516
+ chunk.code = nextCode;
16517
+ return true;
16518
+ } catch {
16519
+ return false;
16520
+ }
16521
+ }
16522
+ function hasAssetRequireCallToFile(source, fileName, targetFileName) {
16523
+ let hasRequireCall = false;
16524
+ rewriteRequireCallLiterals(source, (_requireLiteral, importee) => {
16525
+ if (normalizeRelativeChunkImport(fileName, importee) === targetFileName) hasRequireCall = true;
16526
+ });
16527
+ return hasRequireCall;
16528
+ }
16529
+ function shouldInlineRequestGlobalsAppRegisteredInstallerChunk(fileName) {
16530
+ return fileName !== "weapp-vendors/request-globals-runtime.js" && fileName.startsWith("weapp-vendors/request-globals-");
16531
+ }
16532
+ function toRequestGlobalsAppRegisteredModuleExpression(fileName) {
16533
+ return `globalThis[${JSON.stringify(`${REQUEST_GLOBAL_APP_MODULE_KEY_PREFIX}${fileName}`)}]`;
16534
+ }
16535
+ function toRequestGlobalsRequireModuleExpression(fromFileName, installerChunkFileName) {
16536
+ return `require(${JSON.stringify(toRequireRequestPath(fromFileName, installerChunkFileName))})`;
16537
+ }
16538
+ function toRequestGlobalsInstallerModuleExpression(fromFileName, installerChunkFileName, options = {}) {
16539
+ return options.appRegisteredModule !== false && shouldInlineRequestGlobalsAppRegisteredInstallerChunk(installerChunkFileName) ? toRequestGlobalsAppRegisteredModuleExpression(installerChunkFileName) : toRequestGlobalsRequireModuleExpression(fromFileName, installerChunkFileName);
16540
+ }
16401
16541
  function collapseRequestGlobalsRuntimeSupportChunk(bundle) {
16402
16542
  const runtimeChunk = bundle[REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME];
16403
16543
  if (!runtimeChunk || runtimeChunk.type !== "chunk") return;
@@ -16410,7 +16550,7 @@ function collapseRequestGlobalsRuntimeSupportChunk(bundle) {
16410
16550
  const resolvedImport = normalizeRelativeChunkImport(runtimeOutput.fileName, importee);
16411
16551
  const supportChunk = bundle[resolvedImport];
16412
16552
  if (!supportChunk || supportChunk.type !== "chunk") continue;
16413
- if (resolvedImport === "request-globals-runtime.js" || !resolvedImport.startsWith("request-globals-") && !resolvedImport.endsWith("web-apis-shared.js")) continue;
16553
+ if (resolvedImport === "weapp-vendors/request-globals-runtime.js" || !resolvedImport.startsWith("request-globals-") && !resolvedImport.endsWith("web-apis-shared.js")) continue;
16414
16554
  supportChunkFileName = resolvedImport;
16415
16555
  runtimeRequireMatch = requireMatch;
16416
16556
  break;
@@ -16444,6 +16584,65 @@ function collapseRequestGlobalsRuntimeSupportChunk(bundle) {
16444
16584
  rewriteChunkRequireLiteral(chunk, supportChunkFileName, runtimeOutput.fileName);
16445
16585
  }
16446
16586
  }
16587
+ function injectRequestGlobalsAppRegistration(bundle, installerChunks) {
16588
+ if (installerChunks.size === 0) return;
16589
+ const appOutput = bundle["app.js"];
16590
+ if (!appOutput || appOutput.type !== "chunk") return;
16591
+ const appChunk = appOutput;
16592
+ const requireStatements = [];
16593
+ for (const installerChunkFileName of installerChunks.keys()) {
16594
+ const installerOutput = bundle[installerChunkFileName];
16595
+ if (!installerOutput || installerOutput.type !== "chunk") continue;
16596
+ const requirePath = toRequireRequestPath(appChunk.fileName, installerChunkFileName);
16597
+ if (hasBareRequireRegistration(appChunk.code, requirePath)) continue;
16598
+ requireStatements.push(`require(${JSON.stringify(requirePath)});`);
16599
+ }
16600
+ if (requireStatements.length === 0) return;
16601
+ appChunk.code = `${requireStatements.join("\n")}\n${appChunk.code}`;
16602
+ }
16603
+ function inlineRequestGlobalsAppRegisteredInstallerChunks(bundle, installerChunks, preservedInstallerChunks = /* @__PURE__ */ new Set()) {
16604
+ if (installerChunks.size === 0) return;
16605
+ const appOutput = bundle["app.js"];
16606
+ if (!appOutput || appOutput.type !== "chunk") return;
16607
+ const appChunk = appOutput;
16608
+ const inlinedModules = [];
16609
+ let inlinedIndex = 0;
16610
+ for (const installerChunkFileName of installerChunks.keys()) {
16611
+ if (!shouldInlineRequestGlobalsAppRegisteredInstallerChunk(installerChunkFileName)) continue;
16612
+ const installerOutput = bundle[installerChunkFileName];
16613
+ if (!installerOutput || installerOutput.type !== "chunk") continue;
16614
+ const moduleRef = `__wvRGA${inlinedIndex++}__`;
16615
+ const globalModuleExpression = toRequestGlobalsAppRegisteredModuleExpression(installerChunkFileName);
16616
+ const installerChunk = installerOutput;
16617
+ const embeddedCode = rewriteEmbeddedRequirePaths(installerChunk.code, installerChunk.fileName, appChunk.fileName);
16618
+ let hasPreservedAssetRequire = preservedInstallerChunks.has(installerChunkFileName);
16619
+ inlinedModules.push([
16620
+ `const ${moduleRef} = (() => {`,
16621
+ " const module = { exports: {} }",
16622
+ " const exports = module.exports",
16623
+ embeddedCode,
16624
+ " return module.exports",
16625
+ "})();",
16626
+ `try{${globalModuleExpression}=${moduleRef}}catch{}`
16627
+ ].join("\n"));
16628
+ for (const output of Object.values(bundle)) {
16629
+ if (!output || output.type !== "chunk") continue;
16630
+ const chunk = output;
16631
+ const didRewriteRequire = rewriteChunkRequireCallsToExpression(chunk, installerChunkFileName, globalModuleExpression);
16632
+ const didRewriteImport = rewriteChunkStaticImportsToExpression(chunk, installerChunkFileName, globalModuleExpression);
16633
+ if ((didRewriteRequire || didRewriteImport) && Array.isArray(chunk.imports)) chunk.imports = chunk.imports.filter((importee) => importee !== installerChunkFileName);
16634
+ }
16635
+ for (const output of Object.values(bundle)) {
16636
+ if (!output || output.type !== "asset" || typeof output.fileName !== "string") continue;
16637
+ const source = typeof output.source === "string" ? output.source : output.source?.toString();
16638
+ if (!source) continue;
16639
+ if (hasAssetRequireCallToFile(source, output.fileName, installerChunkFileName)) hasPreservedAssetRequire = true;
16640
+ }
16641
+ if (!hasPreservedAssetRequire) delete bundle[installerChunkFileName];
16642
+ }
16643
+ if (inlinedModules.length === 0) return;
16644
+ appChunk.code = `${inlinedModules.join("\n")}\n${appChunk.code}`;
16645
+ }
16447
16646
  function createRequestGlobalsPreludeCode(chunk, installerChunks, targets, mode, networkDefaults) {
16448
16647
  const chunkTargets = resolveChunkRequestGlobalsTargets(chunk.code, targets, mode);
16449
16648
  if (chunkTargets.length === 0 || chunk.code.includes(REQUEST_GLOBAL_PRELUDE_MARKER)) return;
@@ -16456,7 +16655,7 @@ function createRequestGlobalsPreludeCode(chunk, installerChunks, targets, mode,
16456
16655
  else {
16457
16656
  const installerImport = resolveRequestGlobalsInstallerImport(chunk, installerChunks);
16458
16657
  if (!installerImport?.exportName || !installerImport.installerChunkFileName) return;
16459
- installerHostCode = `require(${JSON.stringify(toRequireRequestPath(chunk.fileName, installerImport.installerChunkFileName))})[${JSON.stringify(installerImport.exportName)}](${createRequestGlobalsInstallerOptionsCode(chunkTargets, networkDefaults)}) || globalThis`;
16658
+ installerHostCode = `${toRequestGlobalsInstallerModuleExpression(chunk.fileName, installerImport.installerChunkFileName)}[${JSON.stringify(installerImport.exportName)}](${createRequestGlobalsInstallerOptionsCode(chunkTargets, networkDefaults)}) || globalThis`;
16460
16659
  }
16461
16660
  return [
16462
16661
  `/* ${REQUEST_GLOBAL_PRELUDE_MARKER} */`,
@@ -16479,7 +16678,7 @@ function createRequestGlobalsPreludeAssetCode(preludeFileName, chunk, installerC
16479
16678
  if (bindingTargets.length === 0) return;
16480
16679
  const installerImport = resolveRequestGlobalsInstallerImport(chunk, installerChunks);
16481
16680
  if (!installerImport?.installerChunkFileName || !installerImport.exportName) return;
16482
- const installerHostCode = `require(${JSON.stringify(toRequireRequestPath(preludeFileName, installerImport.installerChunkFileName))})[${JSON.stringify(installerImport.exportName)}](${createRequestGlobalsInstallerOptionsCode(chunkTargets, networkDefaults)}) || globalThis`;
16681
+ const installerHostCode = `${toRequestGlobalsInstallerModuleExpression(preludeFileName, installerImport.installerChunkFileName, { appRegisteredModule: false })}[${JSON.stringify(installerImport.exportName)}](${createRequestGlobalsInstallerOptionsCode(chunkTargets, networkDefaults)}) || globalThis`;
16483
16682
  return [
16484
16683
  `/* ${REQUEST_GLOBAL_PRELUDE_MARKER} */`,
16485
16684
  `(() => {`,
@@ -16603,7 +16802,8 @@ function createAppPreludeRequireStatement(chunkFileName, preludeFileName) {
16603
16802
  return `/* ${APP_PRELUDE_REQUIRE_MARKER} */require(${JSON.stringify(requestPath)})`;
16604
16803
  }
16605
16804
  function emitAppPreludeRequireAssets(bundle, appPreludeCode, state, requestGlobalsPreludeOptions, emitFile) {
16606
- if (!appPreludeCode) return;
16805
+ const preservedRequestGlobalsInstallerChunks = /* @__PURE__ */ new Set();
16806
+ if (!appPreludeCode) return preservedRequestGlobalsInstallerChunks;
16607
16807
  const preludeFileNames = /* @__PURE__ */ new Set();
16608
16808
  if (state.subPackageMeta?.subPackage.root) preludeFileNames.add(`${state.subPackageMeta.subPackage.root}/${APP_PRELUDE_REQUIRE_FILE_BASENAME}`);
16609
16809
  else {
@@ -16615,18 +16815,25 @@ function emitAppPreludeRequireAssets(bundle, appPreludeCode, state, requestGloba
16615
16815
  const scopeChunks = Object.values(bundle).filter((output) => {
16616
16816
  return output?.type === "chunk" && resolveAppPreludeRequireFileName(output.fileName, state) === fileName;
16617
16817
  });
16618
- const source = [requestGlobalsPreludeOptions.enabled ? scopeChunks.map((chunk) => createRequestGlobalsPreludeAssetCode(fileName, chunk, requestGlobalsPreludeOptions.installerChunks, requestGlobalsPreludeOptions.targets, requestGlobalsPreludeOptions.mode, requestGlobalsPreludeOptions.networkDefaults)).find(Boolean) : void 0, appPreludeCode].filter(Boolean).join("\n");
16818
+ const requestGlobalsPreludeCode = requestGlobalsPreludeOptions.enabled ? scopeChunks.map((chunk) => createRequestGlobalsPreludeAssetCode(fileName, chunk, requestGlobalsPreludeOptions.installerChunks, requestGlobalsPreludeOptions.targets, requestGlobalsPreludeOptions.mode, requestGlobalsPreludeOptions.networkDefaults)).find(Boolean) : void 0;
16819
+ if (requestGlobalsPreludeCode) {
16820
+ const installerImport = scopeChunks.map((chunk) => resolveRequestGlobalsInstallerImport(chunk, requestGlobalsPreludeOptions.installerChunks)).find(Boolean);
16821
+ if (installerImport?.installerChunkFileName) preservedRequestGlobalsInstallerChunks.add(installerImport.installerChunkFileName);
16822
+ }
16823
+ const source = [requestGlobalsPreludeCode, appPreludeCode].filter(Boolean).join("\n");
16619
16824
  emitFile?.({
16620
16825
  type: "asset",
16621
16826
  fileName,
16622
16827
  source: `${source}\n`
16623
16828
  });
16624
16829
  }
16830
+ return preservedRequestGlobalsInstallerChunks;
16625
16831
  }
16626
16832
  function injectAppPreludeCode(bundle, appPreludeCode, options, state, requestGlobalsPreludeOptions, emitFile) {
16627
- if (!options.enabled) return;
16833
+ let preservedRequestGlobalsInstallerChunks = /* @__PURE__ */ new Set();
16834
+ if (!options.enabled) return preservedRequestGlobalsInstallerChunks;
16628
16835
  const entryChunkFileNames = options.mode === "entry" ? collectAppPreludeEntryChunkFileNames(state) : void 0;
16629
- if (options.mode === "require" && appPreludeCode) emitAppPreludeRequireAssets(bundle, appPreludeCode, state, requestGlobalsPreludeOptions, emitFile);
16836
+ if (options.mode === "require" && appPreludeCode) preservedRequestGlobalsInstallerChunks = emitAppPreludeRequireAssets(bundle, appPreludeCode, state, requestGlobalsPreludeOptions, emitFile);
16630
16837
  for (const output of Object.values(bundle)) {
16631
16838
  if (output?.type !== "chunk") continue;
16632
16839
  const chunk = output;
@@ -16637,6 +16844,7 @@ function injectAppPreludeCode(bundle, appPreludeCode, options, state, requestGlo
16637
16844
  if (!injectedCode) continue;
16638
16845
  chunk.code = prependChunkCodePreservingDirectives(chunk.code, injectedCode);
16639
16846
  }
16847
+ return preservedRequestGlobalsInstallerChunks;
16640
16848
  }
16641
16849
  //#endregion
16642
16850
  //#region src/plugins/core/lifecycle/emit/generate.ts
@@ -16807,10 +17015,11 @@ function createGenerateBundleHook(state, isPluginBuild) {
16807
17015
  injectRequestGlobalsPassiveBindings(rolldownBundle, installerChunks, injectRequestGlobalsOptions.targets, injectRequestGlobalsOptions.mode, state.entriesMap);
16808
17016
  injectRequestGlobalsLocalBindings(rolldownBundle, installerChunks, injectRequestGlobalsOptions.targets, injectRequestGlobalsOptions.mode, state.entriesMap, injectRequestGlobalsOptions.networkDefaults);
16809
17017
  injectAxiosFetchAdapterEnv(rolldownBundle);
17018
+ injectRequestGlobalsAppRegistration(rolldownBundle, installerChunks);
16810
17019
  collapseRequestGlobalsRuntimeSupportChunk(rolldownBundle);
16811
17020
  }
16812
17021
  const appPreludeOptions = resolveAppPreludeOptions(state);
16813
- injectAppPreludeCode(rolldownBundle, await resolveAppPreludeCode(scanService.appEntry?.preludePath, {
17022
+ const preservedRequestGlobalsInstallerChunks = injectAppPreludeCode(rolldownBundle, await resolveAppPreludeCode(scanService.appEntry?.preludePath, {
16814
17023
  importMetaDefineRegistry: configService.importMetaDefineRegistry,
16815
17024
  relativePath: scanService.appEntry?.preludePath ? configService.relativeAbsoluteSrcRoot(scanService.appEntry.preludePath) : void 0
16816
17025
  }), {
@@ -16823,6 +17032,7 @@ function createGenerateBundleHook(state, isPluginBuild) {
16823
17032
  networkDefaults: injectRequestGlobalsOptions?.networkDefaults,
16824
17033
  targets: injectRequestGlobalsOptions?.targets ?? []
16825
17034
  }, (asset) => this.emitFile(asset));
17035
+ if (injectRequestGlobalsOptions?.targets?.length) inlineRequestGlobalsAppRegisteredInstallerChunks(rolldownBundle, installerChunks, preservedRequestGlobalsInstallerChunks);
16826
17036
  syncChunkImportsFromRequireCalls(rolldownBundle);
16827
17037
  refreshModuleGraph(this, state);
16828
17038
  if (configService.weappViteConfig?.debug?.watchFiles) {
@@ -22133,6 +22343,17 @@ function createConfigServicePlugin(ctx) {
22133
22343
  //#region src/runtime/jsonPlugin.ts
22134
22344
  const APP_CONFIG_RE = /app\.json(?:\.[jt]s)?$/;
22135
22345
  const SCRIPT_JSON_CONFIG_RE = /\.json\.[jt]s$/;
22346
+ function normalizeAppConfigJson(config) {
22347
+ if (!config || typeof config !== "object" || Array.isArray(config)) return config;
22348
+ const subPackages = Array.isArray(config.subPackages) ? config.subPackages : Array.isArray(config.subpackages) ? config.subpackages : [];
22349
+ return {
22350
+ ...config,
22351
+ subPackages: subPackages.map((subPackage) => ({
22352
+ ...subPackage,
22353
+ pages: Array.isArray(subPackage?.pages) ? subPackage.pages : []
22354
+ }))
22355
+ };
22356
+ }
22136
22357
  function createJsonService(ctx) {
22137
22358
  const cache = ctx.runtimeState.json.cache;
22138
22359
  async function read(filepath) {
@@ -22172,6 +22393,7 @@ function createJsonService(ctx) {
22172
22393
  if (tempFilepath !== filepath) await fs.remove(tempFilepath);
22173
22394
  }
22174
22395
  } else resultJson = parseCommentJson(await fs.readFile(filepath, "utf8"));
22396
+ if (isAppConfig) resultJson = normalizeAppConfigJson(resultJson);
22175
22397
  cache.set(filepath, resultJson);
22176
22398
  return resultJson;
22177
22399
  } catch (error) {
@@ -22521,6 +22743,13 @@ function mergeAutoRouteSubPackages(subPackages, routeSubPackages) {
22521
22743
  if (!changed && anonymousEntries.length === 0) return existingEntries;
22522
22744
  return [...merged.values(), ...anonymousEntries];
22523
22745
  }
22746
+ function normalizeAppConfigSubPackages(config) {
22747
+ config.subPackages = (Array.isArray(config.subPackages) ? config.subPackages : Array.isArray(config.subpackages) ? config.subpackages : []).map((subPackage) => ({
22748
+ ...subPackage,
22749
+ pages: Array.isArray(subPackage?.pages) ? subPackage.pages : []
22750
+ }));
22751
+ return config;
22752
+ }
22524
22753
  async function applyAutoRoutesToAppConfigIfNeeded(ctx, config) {
22525
22754
  const autoRoutesService = ctx.autoRoutesService;
22526
22755
  if (!autoRoutesService?.isEnabled()) return config;
@@ -22541,7 +22770,7 @@ async function applyAutoRoutesToAppConfigIfNeeded(ctx, config) {
22541
22770
  ...subPackage,
22542
22771
  pages: Array.isArray(subPackage.pages) ? subPackage.pages : []
22543
22772
  }));
22544
- return config;
22773
+ return normalizeAppConfigSubPackages(config);
22545
22774
  }
22546
22775
  async function loadAppEntry(ctx, scanState) {
22547
22776
  if (!ctx.configService || !ctx.jsonService) throw new Error("扫描入口前必须初始化 configService/jsonService。");
@@ -22556,7 +22785,7 @@ async function loadAppEntry(ctx, scanState) {
22556
22785
  const vueAppPath = await findVueEntry(appBasename);
22557
22786
  let configFromVue;
22558
22787
  if (!appConfigFile && vueAppPath) {
22559
- const { extractConfigFromVue } = await import("./file-djYgQoCM.mjs");
22788
+ const { extractConfigFromVue } = await import("./file-C0XHk9ks.mjs");
22560
22789
  configFromVue = await extractConfigFromVue(vueAppPath);
22561
22790
  if (configFromVue) appConfigFile = vueAppPath;
22562
22791
  }
@@ -22578,6 +22807,7 @@ async function loadAppEntry(ctx, scanState) {
22578
22807
  else config = await ctx.jsonService.read(appConfigFile);
22579
22808
  await applyAutoRoutesToAppConfigIfNeeded(ctx, config);
22580
22809
  if (isObject(config)) {
22810
+ normalizeAppConfigSubPackages(config);
22581
22811
  const resolvedAppEntry = {
22582
22812
  path: appEntryPath || vueAppPath,
22583
22813
  preludePath: appPreludePath,