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

fix: avoid type mismatch with Rollup (fix #7843) #8701

Merged
merged 2 commits into from Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
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"]
}