nuxt: IDE types are broken after upgrade to 3.6.0 when using Docker (and WSL Webstorm)
Environment
- Operating System: Linux
- Node Version: v18.16.1
- Nuxt Version: 3.6.1
- Nitro Version: 2.5.1
- Package Manager: yarn@3.6.0
- Builder: vite
- User Config: -
- Runtime Modules: -
- Build Modules: -
Reproduction
https://github.com/daniluk4000/nuxt-3.4.2-docker-error
- Run
docker-compose up - Open app.vue with IDE and look at the imports
- Run
sudo yarn dev(as Docker probably broke file system perms if you are not Mac user) - Look at the fixed imports (using VS Code or non-WSL Webstorm)
Describe the bug
Before Nuxt 3.5.3 update tsconfig paths were generated relatively to current directory
But after Nuxt 3.6.0 update it now has absolute paths
And breaks IDE as Docker has different folder names inside of it:
Additional context
This also breaks Webstorm when using with WSL, it can’t resolve imports as well even without using docker for me.
It would be so good, if this was made for some reason, to optionally opt-out and use relative paths.
Logs
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 20
- Comments: 25 (17 by maintainers)
Commits related to this issue
- Upgrade deps, add https://github.com/nuxt/nuxt/issues/21827 issue — committed to daniluk4000/nuxt-3.4.2-docker-error by daniluk4000 a year ago
Sollution offered by @JoakimFFCG requires many manual actions and can become broken with every Nuxt/random plugin update.
Therefore I’ve made my own small plugin for restoring relative paths in dev mode: https://www.npmjs.com/package/nuxt-tsconfig-relative-paths
Please enjoy, report any bugs and feel free to use it as workaround (until Nuxt Team fixes this).
Thanks @daniluk4000 for the module! That fixed it for now but would be happy if the Nuxt team could fix it in Nuxt directly.
I have the same problem, failed to update, rolled back to 3.5.3
We are having the same problem. Does anybody have a workaround?
Seems like I didn’t think about prepare command. Will deploy a fix later today 😃
Didn’t find any, had to rollback as well.
Same issue, bro.
This also breaks the auto-imports in vscode, as it suggests incorrect paths, for example
import { Foo } from 'enums/foo'instead of the correctimport { Foo } from '~/enums/foo'.For just TypeScript Types/Interfaces, this doesn’t have any impact, but any other import will result in an
Failed to resolve import "enums/foo" from "components\Bar.vue"error in build and dev mode.