Support `node:` module prefix (#585)

master
Brad Cornes 2022-07-25 17:43:37 +01:00 committed by GitHub
parent d298014070
commit 0efcdd773e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -9,7 +9,10 @@ process.env.TAILWIND_DISABLE_TOUCH = 'true'
let oldResolveFilename = (Module as any)._resolveFilename let oldResolveFilename = (Module as any)._resolveFilename
;(Module as any)._resolveFilename = (id: any, parent: any) => { ;(Module as any)._resolveFilename = (id: any, parent: any) => {
if (builtInModules.includes(id)) { if (
typeof id === 'string' &&
(builtInModules.includes(id) || builtInModules.includes(id.replace(/^node:/, '')))
) {
return oldResolveFilename(id, parent) return oldResolveFilename(id, parent)
} }
return resolveFrom(path.dirname(parent.id), id) return resolveFrom(path.dirname(parent.id), id)