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

types: improve coverage #1585

Merged
merged 2 commits into from Nov 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/node/build/bundle.ts
Expand Up @@ -2,6 +2,7 @@ import ora from 'ora'
import path from 'path'
import fs from 'fs-extra'
import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite'
import type { GetModuleInfo } from 'rollup'
import { RollupOutput } from 'rollup'
brc-dd marked this conversation as resolved.
Show resolved Hide resolved
import { slash } from '../utils/slash'
import { SiteConfig } from '../config'
Expand Down Expand Up @@ -90,7 +91,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))
) {
Expand Down Expand Up @@ -154,7 +155,7 @@ const cache = new Map<string, boolean>()
/**
* 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) &&
Expand All @@ -166,7 +167,7 @@ function isEagerChunk(id: string, { getModuleInfo }: any) {

function staticImportedByEntry(
id: string,
getModuleInfo: any,
getModuleInfo: GetModuleInfo,
cache: Map<string, boolean>,
importStack: string[] = []
): boolean {
Expand Down