how to use imports in nuxt.config.ts via paths ?
See original GitHub issueEnvironment
Nuxi 3.0.0-rc.10 14:35:32 RootDir: /home/workspace/app/packages/app/web 14:35:33 Nuxt project info: 14:35:33
- Operating System:
Linux
- Node Version:
v18.9.1
- Nuxt Version:
3.0.0-rc.10
- Nitro Version:
0.5.3
- Package Manager:
npm@8.19.1
- Builder:
vite
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Reproduction
import { createBackendConfig } from '@mypath/common-api/config/backendConfig'
in your nuxt.config.ts
Describe the bug
Will result in:
ERROR Cannot start nuxt: Cannot find module '@mypath/common-api/config/backendConfig'
Which is obvious because, it doesn’t know @mypath
in the context of nuxt.config.ts
In Vite I can define this for vite.config.ts
in tsconfig.node.json
because this tsconfig is responsible for the vite.config.ts
due to "include": ["vite.config.ts", "./vite.ts"],
How do I do in nuxt environment for nuxt.config.ts
?
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
You need to fetch from a full URL. Fetching from
/api/test
only works within Nuxt; elsewhere, you need to use a URL likehttps://path.to/my/backend/api/test
.@danielroe Duh!! You da man Dan - thanks so much