Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/playwright/src/transform/esmLoaderSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { currentFileDepsCollector } from './compilationCache';
import { resolveHook, shouldTransform, transformHook } from './transform';
import { fileIsModule } from '../util';

export function resolve(specifier: string, context: { parentURL?: string, conditions?: string[] }, nextResolve: Function) {
export function resolve(specifier: string, context: { parentURL?: string, conditions?: string[] | Set<string> }, nextResolve: Function) {
if (context.parentURL && context.parentURL.startsWith('file://')) {
const filename = url.fileURLToPath(context.parentURL);
const resolved = resolveHook(filename, specifier);
Expand All @@ -32,7 +32,7 @@ export function resolve(specifier: string, context: { parentURL?: string, condit
// - the ESM resolver wants a file:// URL and, on Windows, mistakes an absolute path's
// drive letter for a URL scheme ("Received protocol 'c:'").
// The `import` condition is present only for ESM resolution, so use it to pick the form.
specifier = context.conditions?.includes('import') ? url.pathToFileURL(resolved).toString() : resolved;
specifier = new Set(context.conditions).has('import') ? url.pathToFileURL(resolved).toString() : resolved;
}
}
const result = nextResolve(specifier, context);
Expand Down
Loading