Skip to content

Commit 33458b7

Browse files
authored
fix(loader): support other node versions (microsoft#41319)
1 parent 06dff90 commit 33458b7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/playwright/src/transform/esmLoaderSync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { currentFileDepsCollector } from './compilationCache';
2121
import { resolveHook, shouldTransform, transformHook } from './transform';
2222
import { fileIsModule } from '../util';
2323

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

0 commit comments

Comments
 (0)