-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDE types are broken after upgrade to 3.6.0 when using Docker (and WSL Webstorm) #21827
Comments
We are having the same problem. Does anybody have a workaround? |
I have the same problem, failed to update, rolled back to 3.5.3 |
Same issue, bro. |
Didn't find any, had to rollback as well. |
Add a tsconfig.json file in your project root directory. If you extend .nuxt/tsconfig.json and override the path options with relative paths it should work like before 3.6.0:
|
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). |
Would be great if this can be considered more as just minor :) Because this breaks the dev experience for us, we downgraded to 3.5. However, now we have this issue popping up again which breaks navigation. |
You can try using my plugin for now. That's how we've managed to upgrade. |
@daniluk4000 Hi! Thanks for your plugin. It works but as you said only in dev mode. We use a project with a layer in subfolder for local development and before
I tried your solution without it. And everything seems to work as expected. Building with typecheck works without type errors. |
Seems like I didn't think about prepare command. Will deploy a fix later today :) |
@daniluk4000 Thanks for plugin, doesnt seem to work if |
Didn't think about that case as well. Can you please submit an issue there? https://github.com/daniluk4000/nuxt-tsconfig-relative-paths |
This also breaks the auto-imports in vscode, as it suggests incorrect paths, for example |
Thanks @daniluk4000 for the module! That fixed it for now but would be happy if the Nuxt team could fix it in Nuxt directly. |
@danielroe I have a similar problem. Why is the |
I believe this is already resolved on the edge channel (see linked PR above). |
@danielroe It's much better, but there are still bugs 😞 Some paths are still left with the absolute path:
import type { NavigationGuard } from 'vue-router'
export type MiddlewareKey = string
>>> declare module "/home/xxx/Projects/upscore/node_modules/.pnpm/nuxt3@3.7.0-28194570.99375d68_@types+node@18.17.1_eslint@8.46.0_typescript@5.1.6/node_modules/nuxt3/dist/pages/runtime/composables" {
interface PageMeta {
middleware?: MiddlewareKey | NavigationGuard | Array<MiddlewareKey | NavigationGuard>
}
}
// ...
>>> declare module "/home/xxx/Projects/upscore/node_modules/.pnpm/nuxt3@3.7.0-28194570.99375d68_@types+node@18.17.1_eslint@8.46.0_typescript@5.1.6/node_modules/nuxt3/dist/pages/runtime/composables" {
interface PageMeta {
layout?: MaybeRef<LayoutKey | false> | ComputedRef<LayoutKey | false>
}
}
// ...
>>> export { defineCachedFunction, defineCachedEventHandler, cachedFunction, cachedEventHandler, useRuntimeConfig, useStorage, useNitroApp, defineNitroPlugin, nitroPlugin, defineRenderHandler, getRouteRules, useAppConfig, useEvent } from '/home/xxx/Projects/upscore/node_modules/.pnpm/nitropack-edge@2.6.0-28193343.8c0473c/node_modules/nitropack-edge/dist/runtime';
export { appendCorsHeaders, appendCorsPreflightHeaders, appendHeader, appendHeaders, appendResponseHeader, appendResponseHeaders, assertMethod, callNodeListener, clearResponseHeaders, clearSession, createApp, createAppEventHandler, createError, createEvent, createRouter, defaultContentType, defineEventHandler, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, deleteCookie, dynamicEventHandler, eventHandler, fetchWithEvent, fromNodeMiddleware, getCookie, getHeader, getHeaders, getMethod, getProxyRequestHeaders, getQuery, getRequestHeader, getRequestHeaders, getRequestHost, getRequestPath, getRequestProtocol, getRequestURL, getResponseHeader, getResponseHeaders, getResponseStatus, getResponseStatusText, getRouterParam, getRouterParams, getSession, getValidatedQuery, handleCacheHeaders, handleCors, isCorsOriginAllowed, isError, isEvent, isEventHandler, isMethod, isPreflightRequest, isStream, isWebResponse, lazyEventHandler, parseCookies, promisifyNodeListener, proxyRequest, readBody, readFormData, readMultipartFormData, readRawBody, readValidatedBody, removeResponseHeader, sanitizeStatusCode, sanitizeStatusMessage, sealSession, send, sendError, sendNoContent, sendProxy, sendRedirect, sendStream, sendWebResponse, serveStatic, setCookie, setHeader, setHeaders, setResponseHeader, setResponseHeaders, setResponseStatus, splitCookiesString, toEventHandler, toNodeListener, toPlainHandler, toWebHandler, unsealSession, updateSession, useBase, useSession, writeEarlyHints } from 'h3';
export { buildAssetsURL as __buildAssetsURL, publicAssetsURL as __publicAssetsURL } from '../../node_modules/.pnpm/nuxt3@3.7.0-28194570.99375d68_@types+node@18.17.1_eslint@8.46.0_typescript@5.1.6/node_modules/nuxt3/dist/core/runtime/nitro/paths';
export { defineAppConfig } from '../../node_modules/.pnpm/nuxt3@3.7.0-28194570.99375d68_@types+node@18.17.1_eslint@8.46.0_typescript@5.1.6/node_modules/nuxt3/dist/core/runtime/nitro/config';
{
"compilerOptions": {
...
"paths": {
"#imports": [
"./types/nitro-imports"
],
"#paths": [
"/home/xxx/Projects/upscore/node_modules/.pnpm/nuxt3@3.7.0-28194570.99375d68_@types+node@18.17.1_eslint@8.46.0_typescript@5.1.6/node_modules/nuxt3/dist/core/runtime/nitro/paths"
],
"~": [
"/home/xxx/Projects/upscore"
],
"~/*": [
"/home/xxx/Projects/upscore/*"
],
"@": [
"/home/xxx/Projects/upscore"
],
"@/*": [
"/home/xxx/Projects/upscore/*"
],
"~~": [
"/home/xxx/Projects/upscore"
],
"~~/*": [
"/home/xxx/Projects/upscore/*"
],
"@@": [
"/home/xxx/Projects/upscore"
],
"@@/*": [
"/home/xxx/Projects/upscore/*"
],
"assets": [
"/home/xxx/Projects/upscore/assets"
],
"assets/*": [
"/home/xxx/Projects/upscore/assets/*"
],
"public": [
"/home/xxx/Projects/upscore/public"
],
"public/*": [
"/home/xxx/Projects/upscore/public/*"
],
"#color-mode-options": [
"/home/xxx/Projects/upscore/.nuxt/color-mode-options"
],
"vue-i18n": [
"/home/xxx/Projects/upscore/node_modules/vue-i18n/dist/vue-i18n"
],
"@intlify/shared": [
"/home/xxx/Projects/upscore/node_modules/@intlify/shared/dist/shared"
],
"@intlify/message-compiler": [
"/home/xxx/Projects/upscore/node_modules/@intlify/message-compiler/dist/message-compiler"
],
"@intlify/vue-router-bridge": [
"/home/xxx/Projects/upscore/node_modules/@intlify/vue-router-bridge/lib/index"
],
"@intlify/vue-i18n-bridge": [
"/home/xxx/Projects/upscore/node_modules/@intlify/vue-i18n-bridge/lib/index"
],
"vue-i18n-routing": [
"/home/xxx/Projects/upscore/node_modules/vue-i18n-routing/dist/vue-i18n-routing"
],
"#i18n": [
"/home/xxx/Projects/upscore/node_modules/.pnpm/@nuxtjs+i18n@8.0.0-rc.2_vue@3.3.4/node_modules/@nuxtjs/i18n/dist/runtime/composables"
],
"pinia": [
"/home/xxx/Projects/upscore/node_modules/.pnpm/pinia@2.1.6_typescript@5.1.6_vue@3.3.4/node_modules/pinia/dist/pinia"
]
}
},
"include": [
"/home/xxx/Projects/upscore/.nuxt/types/nitro-nuxt.d.ts",
...
]
} |
@danielroe I just tested and unfortunately it still doesn't work properly... 😞
// Generated by nuxi
{
"compilerOptions": {
...
"baseUrl": "/home/xxx/Projects/upscore",
...
"paths": {
"~": [
"/home/xxx/Projects/upscore"
],
"~/*": [
"/home/xxx/Projects/upscore/*"
],
"@": [
"/home/xxx/Projects/upscore"
],
"@/*": [
"/home/xxx/Projects/upscore/*"
],
"~~": [
"/home/xxx/Projects/upscore"
],
"~~/*": [
"/home/xxx/Projects/upscore/*"
],
"@@": [
"/home/xxx/Projects/upscore"
],
"@@/*": [
"/home/xxx/Projects/upscore/*"
],
"assets": [
"/home/xxx/Projects/upscore/assets"
],
"assets/*": [
"/home/xxx/Projects/upscore/assets/*"
],
"public": [
"/home/xxx/Projects/upscore/public"
],
"public/*": [
"/home/xxx/Projects/upscore/public/*"
],
"#app": [
"/home/xxx/Projects/upscore/node_modules/.pnpm/nuxt3@3.7.0-28201370.c8cba7a0_@types+node@18.17.1_eslint@8.46.0_typescript@5.1.6/node_modules/nuxt3/dist/app"
],
"#app/*": [
"/home/xxx/Projects/upscore/node_modules/.pnpm/nuxt3@3.7.0-28201370.c8cba7a0_@types+node@18.17.1_eslint@8.46.0_typescript@5.1.6/node_modules/nuxt3/dist/app/*"
],
"vue-demi": [
"/home/xxx/Projects/upscore/node_modules/.pnpm/nuxt3@3.7.0-28201370.c8cba7a0_@types+node@18.17.1_eslint@8.46.0_typescript@5.1.6/node_modules/nuxt3/dist/app/compat/vue-demi"
],
"#color-mode-options": [
"/home/xxx/Projects/upscore/.nuxt/color-mode-options.mjs"
],
"vue-i18n": [
"/home/xxx/Projects/upscore/node_modules/vue-i18n/dist/vue-i18n"
],
"@intlify/shared": [
"/home/xxx/Projects/upscore/node_modules/@intlify/shared/dist/shared"
],
"@intlify/message-compiler": [
"/home/xxx/Projects/upscore/node_modules/@intlify/message-compiler/dist/message-compiler"
],
"@intlify/vue-router-bridge": [
"/home/xxx/Projects/upscore/node_modules/@intlify/vue-router-bridge/lib/index"
],
"@intlify/vue-i18n-bridge": [
"/home/xxx/Projects/upscore/node_modules/@intlify/vue-i18n-bridge/lib/index"
],
"vue-i18n-routing": [
"/home/xxx/Projects/upscore/node_modules/vue-i18n-routing/dist/vue-i18n-routing"
],
"#i18n": [
"/home/xxx/Projects/upscore/node_modules/.pnpm/@nuxtjs+i18n@8.0.0-rc.2_vue@3.3.4/node_modules/@nuxtjs/i18n/dist/runtime/composables"
],
"pinia": [
"/home/xxx/Projects/upscore/node_modules/.pnpm/pinia@2.1.6_typescript@5.1.6_vue@3.3.4/node_modules/pinia/dist/pinia"
],
"#vue-router": [
"/home/xxx/Projects/upscore/.nuxt/vue-router"
],
"#imports": [
"/home/xxx/Projects/upscore/.nuxt/imports"
],
"#build": [
"/home/xxx/Projects/upscore/.nuxt"
],
"#build/*": [
"/home/xxx/Projects/upscore/.nuxt/*"
],
"#components": [
"/home/xxx/Projects/upscore/.nuxt/components"
]
}
},
"include": [
"./nuxt.d.ts",
"../**/*",
"../**/*",
"/home/xxx/Projects/upscore",
"/home/xxx/Projects/upscore/*",
"/home/xxx/Projects/upscore",
"/home/xxx/Projects/upscore/*",
"/home/xxx/Projects/upscore",
"/home/xxx/Projects/upscore/*",
"/home/xxx/Projects/upscore",
"/home/xxx/Projects/upscore/*"
],
...
} |
@misaon Would you provide a reproduction? |
Ahhh. Partly the issue for testing on the edge channel is that we hadn't updated nuxi-ng to use the new feature yet: nuxt/cli#74. I've now done that and updated nuxi resolution in your repo - things are looking good but still welcome your review: https://stackblitz.com/edit/github-jz8qdt?file=package.json |
@danielroe Perfect. Now tsconfig.json is fine! The only problem that persists for me is one line in export { defineCachedFunction, defineCachedEventHandler, cachedFunction, cachedEventHandler, useRuntimeConfig, useStorage, useNitroApp, defineNitroPlugin, nitroPlugin, defineRenderHandler, getRouteRules, useAppConfig, useEvent } from '/home/xxx/Projects/upscore/node_modules/.pnpm/nitropack-edge@2.6.0-28201478.6430ded/node_modules/nitropack-edge/dist/runtime';
|
@danielroe Sorry, your reproduction is wrong too: export { defineCachedFunction, defineCachedEventHandler, cachedFunction, cachedEventHandler, useRuntimeConfig, useStorage, useNitroApp, defineNitroPlugin, nitroPlugin, defineRenderHandler, getRouteRules, useAppConfig, useEvent } z '/home/projects/github-jz8qdt/node_modules/.pnpm/nitropack-edge@2.6.0-28201478.6430ded/node_modules/nitropack-edge/dist/runtime'; |
We can probably keep this issue closed, |
For anyone there who installed my module: please remove it when upgrading to Nuxt 3.7. In newest version of module I have also added warnings for that and disabled module for Nuxt 3.7. |
Environment
Reproduction
https://github.com/daniluk4000/nuxt-3.4.2-docker-error
docker-compose up
sudo yarn dev
(as Docker probably broke file system perms if you are not Mac user)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
The text was updated successfully, but these errors were encountered: