Issue
When trying to do an import .ts file in 'nuxt.config.ts' using the path '@/' and '~/' I get the error: Cannot find module '~/path', Require stack: - nuxt.config.ts at Module._resolveFilename....
Sample code in the nuxt.config.ts file
// this code does not work
import headConfig from '~/config/head/headConfig';
// import headConfig from '@/config/head/headConfig';
// this code work
// import headConfig from './config/head/headConfig';
export default defineNuxtConfig({
devtools: { enabled: false },
app: {
head: headConfig,
},
});
Nuxt 3.8.2 | node 18.18.0 | npm 9.4.2
Solution
That feature is currently not supported. So, inside the nuxt.config.ts
file, you have to use relative or absolute paths for import
.
Answered By - Triet Doan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.