refactor: remove relativePath processing
This commit is contained in:
parent
b5b08dbe55
commit
34ebcd939a
1 changed files with 2 additions and 3 deletions
|
@ -36,14 +36,13 @@ export default eventHandler(async (event) => {
|
||||||
const __filename = fileURLToPath(import.meta.url)
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
const __dirname = dirname(__filename)
|
const __dirname = dirname(__filename)
|
||||||
let relativePath = relative(__dirname, appConfigFile)
|
let relativePath = relative(__dirname, appConfigFile)
|
||||||
relativePath = relativePath.replace('.mjs', '').replace('../', '')
|
|
||||||
|
|
||||||
console.log('>>> relative', relativePath)
|
console.log('>>> relative', relativePath)
|
||||||
|
|
||||||
let config
|
let config
|
||||||
// TODO: this still doesn't work on Netlify
|
// TODO: this still doesn't work on Netlify
|
||||||
try {
|
try {
|
||||||
const { default: configFn } = await import(`../${relativePath}.mjs`)
|
const { default: configFn } = await import(relativePath)
|
||||||
config = configFn()
|
config = configFn()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
consola.error(err)
|
consola.error(err)
|
||||||
|
@ -52,7 +51,7 @@ export default eventHandler(async (event) => {
|
||||||
console.log('>>> ', {
|
console.log('>>> ', {
|
||||||
config,
|
config,
|
||||||
appConfigFile,
|
appConfigFile,
|
||||||
relativePath: `../${relativePath}.mjs`,
|
relativePath,
|
||||||
__dirname,
|
__dirname,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue