Skip to content

Commit

Permalink
perf: deprecate deps.registerNodeLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Aug 1, 2023
1 parent b8dc99b commit 7f45bf2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 9 additions & 3 deletions packages/vitest/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,15 @@ export function resolveConfig(
?? resolve(resolved.root, resolved.runner)
}

// disable loader for Yarn PnP until Node implements chain loader
// https://github.com/nodejs/node/pull/43772
resolved.deps.registerNodeLoader ??= false
if (resolved.deps.registerNodeLoader) {
const transformMode = resolved.environment === 'happy-dom' || resolved.environment === 'jsdom' ? 'web' : 'ssr'
console.warn(
c.yellow(
`${c.inverse(c.yellow(' Vitest '))} "deps.registerNodeLoader" is deprecated.`
+ `If you rely on aliases inside external packages, use "deps.optimizer.${transformMode}.include" instead.`,
),
)
}

resolved.testNamePattern = resolved.testNamePattern
? resolved.testNamePattern instanceof RegExp
Expand Down
3 changes: 1 addition & 2 deletions packages/vitest/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,20 @@ interface DepsOptions {
* @default false
*
* @deprecated Use `server.deps.fallbackCJS` instead.
*
*/
fallbackCJS?: boolean

/**
* Use experimental Node loader to resolve imports inside node_modules using Vite resolve algorithm.
* @default false
* @deprecated If you rely on aliases inside external packages, use `deps.optimizer.{web,ssr}.include` instead.
*/
registerNodeLoader?: boolean

/**
* A list of directories relative to the config file that should be treated as module directories.
*
* @default ['node_modules']
*
*/
moduleDirectories?: string[]
}
Expand Down

0 comments on commit 7f45bf2

Please sign in to comment.