mirror of
https://github.com/hanzoai/vitest.git
synced 2026-09-24 17:04:25 +00:00
16 lines
431 B
TypeScript
16 lines
431 B
TypeScript
if (globalThis.process?.env.VITE_MODULE_RUNNER === 'false') {
|
|
const { registerHooks } = await import('node:module')
|
|
|
|
registerHooks({
|
|
resolve(specifier, context, nextResolve) {
|
|
if (context.parentURL && specifier.startsWith('.') && !/\.[a-z]+$/.test(specifier) && !context.parentURL.includes('/node_modules/')) {
|
|
specifier += '.ts'
|
|
}
|
|
|
|
return nextResolve(specifier, context)
|
|
},
|
|
})
|
|
}
|
|
|
|
export {}
|