Skip to content
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

Cannot find base config file @vue/tsconfig/tsconfig.web.json #13

Closed
UglyHobbitFeet opened this issue Apr 26, 2023 · 26 comments
Closed

Cannot find base config file @vue/tsconfig/tsconfig.web.json #13

UglyHobbitFeet opened this issue Apr 26, 2023 · 26 comments

Comments

@UglyHobbitFeet
Copy link

I upgraded from 0.1.3 to 0.3.2 and am now seeing the error "Cannot find base config file @vue/tsconfig/tsconfig.web.json"

Full stacktrace is below:


> vue-tsc --noEmit --skipLibCheck

▲ [WARNING] Cannot find base config file "@vue/tsconfig/tsconfig.web.json" [tsconfig.json]

    tsconfig.json:2:13:
      2 │   "extends": "@vue/tsconfig/tsconfig.web.json",
        ╵              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vite v4.3.2 building for production...
✓ 2 modules transformed.
✓ built in 785ms
[vite:esbuild] failed to resolve "extends":"@vue/tsconfig/tsconfig.web.json" in /<my-path>/tsconfig.json
file: /<my-path>/main.ts
error during build:
TSConfckParseError: failed to resolve "extends":"@vue/tsconfig/tsconfig.web.json" in /<my-path>/tsconfig.json
    at resolveExtends (file:////<my-path>/node_modules/vite/dist/node/chunks/dep-7efa13d7.js:13544:9)
    at parseExtends (file:////<my-path>/node_modules/vite/dist/node/chunks/dep-7efa13d7.js:13498:28)
    at parse$f (file:////<my-path>/node_modules/vite/dist/node/chunks/dep-7efa13d7.js:13436:24)
    at async loadTsconfigJsonForFile (file:////<my-path>/node_modules/vite/dist/node/chunks/dep-7efa13d7.js:14057:24)
    at async transformWithEsbuild (file:////<my-path>/node_modules/vite/dist/node/chunks/dep-7efa13d7.js:13742:36)
    at async Object.transform (file:////<my-path>/node_modules/vite/dist/node/chunks/dep-7efa13d7.js:13867:32)
    at async transform (file:////<my-path>/node_modules/rollup/dist/es/shared/node-entry.js:23499:16)
    at async ModuleLoader.addModuleSource (file:////<my-path>/node_modules/rollup/dist/es/shared/node-entry.js:23705:30)
ERROR: "build-only" exited with 1.
@Kr0nox
Copy link

Kr0nox commented Apr 26, 2023

Quotes from the README:

Requires TypeScript >= 5.0. For TypeScript v4.5 to v4.9, please use v0.1.x.

Migrating from TypeScript < 5.0
The usage of base tsconfig.json is unchanged.
tsconfig.web.json is now renamed to tsconfig.dom.json, to align with @vue/runtime-dom and @vue/compiler-dom.

@UglyHobbitFeet
Copy link
Author

UglyHobbitFeet commented Apr 26, 2023 via email

@Kr0nox
Copy link

Kr0nox commented Apr 27, 2023

then to my understanding you just need to change the name of the file in the extends part

tsconfig.web.json is now renamed to tsconfig.dom.json

@UglyHobbitFeet
Copy link
Author

UglyHobbitFeet commented Apr 27, 2023

Thanks for the info. I seem to be getting closer.

I have a tsconfig.json file which extends the tsconfig.web.json. I changed that to tsconfig.dom.json as you mentioned.

I also have a tsconfig.config.json which extends tsconfig.node.json. When doing an npm run build I get an TSConfckParseError: failed to resolve "extends":"@vue/tsconfig/tsconfig.node.json" error. So, I also changed that to extend tsconfig.dom.json and it got further but then gave me the following error:

error TS2688: Cannot find type definition file for 'vuetify'.
  The file is in the program because:
    Entry point of type library 'vuetify' specified in compilerOptions

  tsconfig.json:12:15
    12     "types": ["vuetify"],
                     ~~~~~~~~~
    File is entry point of type library specified here.

FWIW I am using the latest Vuetify v3.1.16. This error did not occur before. Is there another place I should be pointing tsconfig.node.json to besides tsconfig.dom.json?

Thanks!

@Kr0nox
Copy link

Kr0nox commented Apr 27, 2023

The README futher says:

tsconfig.node.json is removed, please read the Node.js section above for Node.js usage.

So read this for the in detail describtion for how to migrate the @vue/tsconfig/tsconfig.node.json

@UglyHobbitFeet
Copy link
Author

Hi, thanks for pointing me in that direction. I am still experiencing similar issues... perhaps I'm unclear on which file(s) to change and where to reference 'vuetify'. (I have tried removing the vuetify ref from either/both files). This is what I currently have:

npm add -D @tsconfig/node16 @types/node@16

tsconfig.json

{
  "extends": "@vue/tsconfig/tsconfig.dom.json",
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.d"],
  "compilerOptions": {
    "baseUrl": ".",
    "lib": ["ES2021", "DOM"],
    "paths": {
      "@/*": ["./src/*"]
    },
    "skipLibCheck": true,
    "strict": true,
    "types": ["node", "vuetify"],
    // workaround for https://github.com/vuejs/tsconfig/issues/6
    "preserveValueImports": false,
    "importsNotUsedAsValues": "remove",
    "verbatimModuleSyntax": true,
    // end workaround
  },

  "references": [
    {
      "path": "./tsconfig.config.json"
    }
  ]
}

tsconfig.config.json

{
  "extends": [
    "@tsconfig/node16/tsconfig.json",
    "@vue/tsconfig/tsconfig.json"
  ],
  "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"],
  "compilerOptions": {
    "composite": true,
    "skipLibCheck": true,
    "types": ["node", "vuetify"]
  }
}

Then try to build:

npm run build

error TS2688: Cannot find type definition file for 'vuetify'.
  The file is in the program because:
    Entry point of type library 'vuetify' specified in compilerOptions

  tsconfig.json:12:23
    12     "types": ["node", "vuetify"],
                             ~~~~~~~~~
    File is entry point of type library specified here.


Found 1 error.

ERROR: "type-check" exited with 2.

@Kr0nox
Copy link

Kr0nox commented Apr 27, 2023

Does it compile when you remove "types": ["node", "vuetify"] from your tsconfig.json?

Alternativly does it help when you change "extends": "@vue/tsconfig/tsconfig.dom.json" in your tsconfig.json to "extends": [ "@tsconfig/node16/tsconfig.json", "@vue/tsconfig/tsconfig.dom.json" ]

@UglyHobbitFeet
Copy link
Author

If I remove the 'types' as you suggested it compiles but throws tons of lint-type errors about not finding Vuetify. For example "error TS2307: Cannot find module 'vuetify/lib/components/index' or its corresponding type declarations"

If I modify the extends as you suggested (while also keeping 'types' modified as you suggested) I get the same errors as above

If I modify the extends as you suggested (but undo the 'types' modification you suggested) I get compile errors: error TS2688: Cannot find type definition file for 'vuetify'.

@UglyHobbitFeet
Copy link
Author

Just an fyi, but these *may be related? vuetifyjs/vuetify#17211

@Kr0nox
Copy link

Kr0nox commented Apr 27, 2023

May be possible, I'll have a deeper look at it later.
Just to confirm this isn't the issue: under node_modules/@types there is a subfolder for vuetify?

@UglyHobbitFeet
Copy link
Author

Hmm, there is no vuetify subfolder under that path. I deleted the package-lock.json file and re-ran npm install but it never creates that at that location. FWIW here's my package.json file

{
  "name": "myProj",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "run-p type-check build-only",
    "preview": "vite preview",
    "build-only": "vite build",
    "type-check": "vue-tsc --noEmit --skipLibCheck",
    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
  },
  "dependencies": {
    "@apollo/client": "^3.7.12",
    "@json2csv/node": "^6.1.3",
    "@json2csv/plainjs": "^6.1.3",
    "@mdi/font": "7.2.96",
    "@mdi/js": "^7.2.96",
    "@vitejs/plugin-basic-ssl": "^1.0.1",
    "@vue/apollo-composable": "^4.0.0-beta.4",
    "@vue/apollo-option": "^4.0.0-beta.4",
    "axios": "^1.3.6",
    "chart.js": "^4.2.1",
    "chartjs-plugin-zoom": "^2.0.1",
    "graphql": "^16.6.0",
    "graphql-tag": "^2.12.6",
    "graphql-ws": "^5.12.1",
    "md5": "^2.3.0",
    "mitt": "^3.0.0",
    "ol": "^7.3.0",
    "ol-contextmenu": "^5.2.1",
    "pinia": "^2.0.35",
    "pinia-plugin-persistedstate": "^3.1.0",
    "sass": "^1.62.1",
    "sass-loader": "^13.2.2",
    "sortablejs": "^1.15.0",
    "uuid": "^9.0.0",
    "vue": "^3.2.47",
    "vue-router": "^4.1.6",
    "vuetify": "^3.1.16"
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.1.4",
    "@tsconfig/node16": "^1.0.3",
    "@types/node": "^16.18.25",
    "@types/sortablejs": "^1.15.1",
    "@types/uuid": "^9.0.1",
    "@vitejs/plugin-vue": "^4.2.1",
    "@vue/eslint-config-typescript": "^11.0.3",
    "@vue/tsconfig": "^0.3.2",
    "eslint": "^8.39.0",
    "eslint-plugin-vue": "^9.11.0",
    "npm-run-all": "^4.1.5",
    "typescript": "~5.0.4",
    "vite": "^4.3.3",
    "vite-plugin-vuetify": "^1.0.2",
    "vue-tsc": "^1.6.0"
  }
}

@UglyHobbitFeet
Copy link
Author

also afaik there is no @types/vuetify dependency. If I add one I get the 404 '@types/vuetify@^3.1.16' is not in this registry message

@sabifa
Copy link

sabifa commented Apr 28, 2023

I'm experiencing similar issues.

What I did:

  • Installed @tsconfig/node18 & @types/node
  • "extends": "@vue/tsconfig/tsconfig.web.json", -> "extends": "@vue/tsconfig/tsconfig.dom.json"
  • "extends": "@vue/tsconfig/tsconfig.node.json" -> "extends": ["@tsconfig/node18/tsconfig.json", "@vue/tsconfig/tsconfig.json"]

When I run npm run build I also get a lot of errors, but in my case for vue-i18n (I am not using vuetify):

src/features/home/view/homeView.vue:4:10 - error TS2339: Property '$t' does not exist on type '{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> & Omit<Readonly<ExtractPropTypes<{}>> & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>; ... 10 more ...; $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => ...'.

4   <h1>{{ $t('home.greeting') }}</h1>
           ~~

or

src/features/machineDetail/components/MachineDetailDatetimeFilter.vue:4:25 - error TS7016: Could not find a declaration file for module 'vue-i18n'. 'XXX/node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js' implicitly has an 'any' type.
  There are types at 'C:/_source/stuertz/Cloud/Stuertz.Frontend/node_modules/vue-i18n/dist/vue-i18n.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vue-i18n' library may need to update its package.json or typings.

import { useI18n } from 'vue-i18n';
                          ~~~~~~~~~

Is this an issue with the @vue/tsconfig lib or does vue-i18n needs to be updated?

@Kr0nox
Copy link

Kr0nox commented Apr 28, 2023

Just experimented a bit on my machine, could not recreate the issue tho.

also afaik there is no @types/vuetify dependency. If I add one I get the 404 '@types/vuetify@^3.1.16' is not in this registry message

Yes that is true. Afaik the types file is in the @vuetify folder, so maybe adding this to the tsconfig file where you import vuetifys types helps: "typeRoots": ["./node_modules/@types", "./node_modules/@vueutify"],

@Kr0nox
Copy link

Kr0nox commented Apr 28, 2023

Is this an issue with the @vue/tsconfig lib or does vue-i18n needs to be updated?

Could I see your package.json?

@sabifa
Copy link

sabifa commented Apr 28, 2023

Could I see your package.json?

Sure, here it is:

click

package.json

{
  "name": "xxx",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "run-p type-check build-only",
    "preview": "vite preview",
    "test": "vitest --environment jsdom --root src/",
    "test:unit": "vitest run --environment jsdom --root src/",
    "build-only": "vite build",
    "type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.4.0",
    "@fortawesome/free-solid-svg-icons": "^6.4.0",
    "@fortawesome/vue-fontawesome": "^3.0.3",
    "@intlify/unplugin-vue-i18n": "^0.10.0",
    "@vueuse/core": "^10.1.0",
    "echarts": "^5.4.2",
    "naive-ui": "^2.34.3",
    "pinia": "^2.0.35",
    "vue": "^3.2.47",
    "vue-echarts": "^6.5.5",
    "vue-i18n": "^9.2.2",
    "vue-router": "^4.1.6"
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.2.0",
    "@types/jsdom": "^21.1.1",
    "@types/node": "^18.16.0",
    "@vitejs/plugin-vue": "^4.2.0",
    "@vue/eslint-config-prettier": "^7.1.0",
    "@vue/eslint-config-typescript": "^11.0.3",
    "@vue/test-utils": "^2.3.2",
    "@vue/tsconfig": "^0.1.3",
    "eslint": "^8.39.0",
    "eslint-plugin-vue": "^9.11.0",
    "jsdom": "^21.1.1",
    "npm-run-all": "^4.1.5",
    "prettier": "^2.8.8",
    "sass": "^1.62.0",
    "typescript": "~5.0.4",
    "vite": "^4.3.1",
    "vitest": "^0.30.1",
    "vue-tsc": "^1.4.4"
  }
}

@Kr0nox
Copy link

Kr0nox commented Apr 28, 2023

I am not 100% sure, but from the error message and looking at your, vue-i18n und this repos package.json I would have guessed the issue lies with vue-i18n, since its the only place I could find a "exports" statement, but as I said, not completly sure

@UglyHobbitFeet
Copy link
Author

Just experimented a bit on my machine, could not recreate the issue tho.

also afaik there is no @types/vuetify dependency. If I add one I get the 404 '@types/vuetify@^3.1.16' is not in this registry message

Yes that is true. Afaik the types file is in the @vuetify folder, so maybe adding this to the tsconfig file where you import vuetifys types helps: "typeRoots": ["./node_modules/@types", "./node_modules/@vueutify"],

No luck. I added it to the compilerOptions for both tsconfig.json and tsconfig.config.json and I still get the error TS2688: Cannot find type definition file for 'vuetify'.

"typeRoots": ["./node_modules/@types", "./node_modules/@vuetify"]

@pedro-pmda
Copy link

pedro-pmda commented Apr 28, 2023

ify ref from either/b

Hi!! I've experimented same problems too afer update to latest tsconfig version

In my case I build in run ok, but I've got problems typing-check: vue-tsc --noEmit -p tsconfig.vitest.json --composite false"

`` vue-tsc --noEmit -p tsconfig.vitest.json --composite false`

src/plugins/vuetify.ts:3:22 - **error TS7016: Could not find a declaration file for module 'vuetify/components'.** '/home/*****/***/*****/*****/node_modules/vuetify/lib/components/index.mjs' implicitly has an 'any' type.
  There are types at '/home/*****/***/*****/*****/node_modules/vuetify/lib/components/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vuetify' library may need to update its package.json or typings.
`

Thanks for your help ☺️

@throrin19
Copy link

Hi, same problem for me for the $t error and other weird stuff (libraries won't find the index.d.ts but the file already exists).

I fix my problem by set the moduleResolution to node instead of bundler

@tryforceful
Copy link

FWIW I have the same issue that @throrin19 and @sabifa are reporting, with vue-i18n and v-calendar. Using moduleResolution: 'node' also fixes it for me for now, but I would like to opt in to using the new "bundler" feature eventually...

Any advice on what kind of fix needs to be made in the vue-i18n and v-calendar packages to address this? So we can notify them / contribute

this result could not be resolved when respecting package.json "exports". The '____' library may need to update its package.json or typings.

This message is very vague to me...

@ffxsam
Copy link

ffxsam commented May 4, 2023

There's probably a reason a new Vue 3 project ships with version ^0.1.3 of this package. Unfortunately, the latest version seems to introduce issues, even after renaming the tsconfig.*.json files.

@UglyHobbitFeet
Copy link
Author

Any update on this issue? It still fails with the latest v0.4.0

@UglyHobbitFeet
Copy link
Author

UglyHobbitFeet commented May 25, 2023

I think I have it resolved. The newest version of vuetify is causing my issues (v3.3.1) Reverting to v3.2.5 seems to make them go away. FWIW here are my working files:

tsconfig.json

{
  "extends": "@tsconfig/node18/tsconfig.json",
  "compilerOptions": {
    "baseUrl": ".",
    "lib": ["esnext", "DOM"],
    "paths": {
      "@/*": ["./src/*"],
    },
    "types": ["node", "vuetify"],
  },
  "references": [
    {
      "path": "./tsconfig.config.json"
    }
  ]
}

tsconfig.config.json

{
  "extends": "@tsconfig/node18/tsconfig.json",
  "include": ["vite.config.ts"],
  "compilerOptions": {
    "composite": true,
    "skipLibCheck": true,
    "types": ["node", "vuetify"],
    "paths": {
      "@/*": ["./src/*"],
    }
  }
}

package.json (trimmed down to only show relevant packages)

"dependencies": {
...
    "vue": "^3.3.4",
    "vuetify": "3.1.14"
},  
"devDependencies": {
    "@tsconfig/node18": "^2.0.1",
    "@types/node": "^18.16.14",
    "@vitejs/plugin-vue": "^4.2.3",
    "@vue/tsconfig": "^0.4.0",
    "typescript": "^5.0.4",
    "vite": "^4.3.8",
    "vite-plugin-vuetify": "^1.0.2",
    "vue-tsc": "^1.6.5"
}

@throrin19
Copy link

@UglyHobbitFeet I think you have to make an issue into vuetify to make them fix this problem 👍

@andrewbauxier
Copy link

I had the same issue running a cloned project from another company using VS Code after running 'npm install' and 'npm audit fix'. If this sounds familiar, restarting VS Code solved the issue. The file was there, but VS Code needed to reload for the error to resolve itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants