mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-03 19:07:15 +00:00
chore: simplify loadFixture
This commit is contained in:
parent
2f2ec7ac30
commit
e1d4dd59c7
@ -16,12 +16,13 @@ export const loadFixture = async function (fixture, overrides) {
|
|||||||
const rootDir = path.resolve(__dirname, '..', 'fixtures', fixture)
|
const rootDir = path.resolve(__dirname, '..', 'fixtures', fixture)
|
||||||
let config = {}
|
let config = {}
|
||||||
|
|
||||||
for (const ext of ['ts', 'js']) {
|
try {
|
||||||
const configFile = path.resolve(rootDir, `nuxt.config.${ext}`)
|
await import(`../fixtures/${fixture}/nuxt.config`)
|
||||||
if (fs.existsSync(configFile)) {
|
|
||||||
config = await import(`../fixtures/${fixture}/nuxt.config`)
|
|
||||||
config = config.default || config
|
config = config.default || config
|
||||||
break
|
} catch (e) {
|
||||||
|
// Ignore MODULE_NOT_FOUND
|
||||||
|
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||||
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user