-
Notifications
You must be signed in to change notification settings - Fork 32
Non-relative paths are not allowed when 'baseUrl' is not set. #107
Comments
To override this temporarily, in your {
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"paths": {
"#pwa": [
"./.nuxt/types/pwa"
],
}
}
} |
Just sharing thoughts, I might be wrong again too.I stand corrected, applying the above solution caused some weird behavior in typescript in my project, leading to some variables being set as type The proper method to override the paths in ./.nuxt/tsconfig.json as per https://nuxt.com/docs/guide/concepts/typescript#nuxttsconfigjson is to use alias:{
"#pwa": "./.nuxt/types/pwa"
}, |
@mo9a7i doesnt overwrite it for me. diff --git a/dist/module.mjs b/dist/module.mjs
index 73a3c87b5c1af0571337c66dbe6f0aef36a0034e..319493594d33cdcf7b00f6a4e0d79fd5b43fe752 100644
--- a/dist/module.mjs
+++ b/dist/module.mjs
@@ -153,7 +153,7 @@ const icon = async (pwa) => {
getContents: () => `export type IconSize = number | ${options.sizes.map((size) => `'${size}'`).join(" | ")}`
}).dst.replace(/\.d\.ts$/, "");
nuxt.hook("prepare:types", ({ tsConfig }) => {
- tsConfig.compilerOptions.paths["#pwa"] = [relative(nuxt.options.srcDir, typesPath)];
+ tsConfig.compilerOptions.paths["#pwa"] = ["./" + relative(nuxt.options.srcDir, typesPath)];
});
}; |
Seems i did something different to make it work have a look here https://github.com/ithra-2023/nuxtjs-ithra-pwa check the .vscode file and check nuxt config for take over mode whenever I apply those, i delete node modules and .nuxt folder and install again |
Try: |
Cause the Nuxt: 3.7 use purely relative paths in the generated tsconfig.json instead of setting a baseUrl, there will throw error when type check.
The text was updated successfully, but these errors were encountered: