mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxi, kit): enable esmResolve
flag for jiti
(#6356)
This commit is contained in:
parent
1f00a9f011
commit
e3534bcda5
@ -4,7 +4,7 @@ import { interopDefault } from 'mlly'
|
||||
import jiti from 'jiti'
|
||||
|
||||
// TODO: use create-require for jest environment
|
||||
const _require = jiti(process.cwd(), { interopDefault: true })
|
||||
const _require = jiti(process.cwd(), { interopDefault: true, esmResolve: true })
|
||||
|
||||
export interface ResolveModuleOptions {
|
||||
paths?: string | string[]
|
||||
|
@ -115,7 +115,7 @@ function normalizeConfigModule (module, rootDir) {
|
||||
|
||||
function getNuxtConfig (rootDir) {
|
||||
try {
|
||||
return jiti(rootDir, { interopDefault: true })('./nuxt.config')
|
||||
return jiti(rootDir, { interopDefault: true, esmResolve: true })('./nuxt.config')
|
||||
} catch (err) {
|
||||
// TODO: Show error as warning if it is not 404
|
||||
return {}
|
||||
|
@ -154,7 +154,7 @@ export default {
|
||||
val = process.env.NUXT_CREATE_REQUIRE || val ||
|
||||
(typeof globalThis.jest !== 'undefined' ? 'native' : 'jiti')
|
||||
if (val === 'jiti') {
|
||||
return p => jiti(typeof p === 'string' ? p : p.filename)
|
||||
return p => jiti(typeof p === 'string' ? p : p.filename, { esmResolve: true })
|
||||
}
|
||||
if (val === 'native') {
|
||||
return p => createRequire(typeof p === 'string' ? p : p.filename)
|
||||
|
Loading…
Reference in New Issue
Block a user