diff --git a/src/node/build/bundle.ts b/src/node/build/bundle.ts index 8bab50bd..7da869cd 100644 --- a/src/node/build/bundle.ts +++ b/src/node/build/bundle.ts @@ -2,7 +2,7 @@ import ora from 'ora' import path from 'path' import fs from 'fs-extra' import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite' -import { RollupOutput } from 'rollup' +import { GetModuleInfo, RollupOutput } from 'rollup' import { slash } from '../utils/slash' import { SiteConfig } from '../config' import { APP_PATH } from '../alias' @@ -90,7 +90,7 @@ export async function bundle( return 'framework' } if ( - isEagerChunk(id, ctx) && + isEagerChunk(id, ctx.getModuleInfo) && (/@vue\/(runtime|shared|reactivity)/.test(id) || /vitepress\/dist\/client/.test(id)) ) { @@ -154,7 +154,7 @@ const cache = new Map() /** * Check if a module is statically imported by at least one entry. */ -function isEagerChunk(id: string, { getModuleInfo }: any) { +function isEagerChunk(id: string, getModuleInfo: GetModuleInfo) { if ( id.includes('node_modules') && !/\.css($|\\?)/.test(id) && @@ -166,7 +166,7 @@ function isEagerChunk(id: string, { getModuleInfo }: any) { function staticImportedByEntry( id: string, - getModuleInfo: any, + getModuleInfo: GetModuleInfo, cache: Map, importStack: string[] = [] ): boolean {