Skip to content

Commit

Permalink
fix: avoid type mismatch with Rollup (fix #7843) (#8701)
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Jun 24, 2022
1 parent d912399 commit 87e51f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
13 changes: 7 additions & 6 deletions packages/vite/src/node/plugin.ts
Expand Up @@ -128,7 +128,7 @@ export interface Plugin extends RollupPlugin {
/**
* extend hooks with ssr flag
*/
resolveId?(
resolveId?: (
this: PluginContext,
source: string,
importer: string | undefined,
Expand All @@ -139,17 +139,18 @@ export interface Plugin extends RollupPlugin {
* @internal
*/
scan?: boolean
isEntry: boolean
}
): Promise<ResolveIdResult> | ResolveIdResult
load?(
) => Promise<ResolveIdResult> | ResolveIdResult
load?: (
this: PluginContext,
id: string,
options?: { ssr?: boolean }
): Promise<LoadResult> | LoadResult
transform?(
) => Promise<LoadResult> | LoadResult
transform?: (
this: TransformPluginContext,
code: string,
id: string,
options?: { ssr?: boolean }
): Promise<TransformResult> | TransformResult
) => Promise<TransformResult> | TransformResult
}
4 changes: 3 additions & 1 deletion packages/vite/src/node/server/pluginContainer.ts
Expand Up @@ -97,6 +97,7 @@ export interface PluginContainer {
* @internal
*/
scan?: boolean
isEntry?: boolean
}
): Promise<PartialResolvedId | null>
transform(
Expand Down Expand Up @@ -527,6 +528,7 @@ export async function createPluginContainer(
const skip = options?.skip
const ssr = options?.ssr
const scan = !!options?.scan
const isEntry = !!options?.isEntry
const ctx = new Context()
ctx.ssr = !!ssr
ctx._scan = scan
Expand All @@ -546,7 +548,7 @@ export async function createPluginContainer(
ctx as any,
rawId,
importer,
{ ssr, scan }
{ ssr, scan, isEntry }
)
if (!result) continue

Expand Down
4 changes: 3 additions & 1 deletion packages/vite/tsconfig.check.json
Expand Up @@ -14,7 +14,9 @@
// indirect: postcss depends on it
"source-map-js": ["./node_modules/source-map-js/source-map.d.ts"]
},
"typeRoots": []
"typeRoots": [],
"strict": true,
"exactOptionalPropertyTypes": true
},
"include": ["dist/**/*.d.ts"]
}

0 comments on commit 87e51f7

Please sign in to comment.