Open SaschaAusUlm opened 1 year ago
I also have recently migrated a project from vue-cli to vite, in hopes of migrating to Vue 3 soon. And I ran into similar issues. Are your declare module
statements located in the "project" as defined by your tsconfig.json (include
or files
)?
One thing that was causing a lot of issues for our project was that TypeScript stopped seeing the declare module
statements from third party libraries in node_modules. I realized that the reason for this was because I had changed my tsconfig.json moduleResolution
to "bundler" from "node", and with that moduleResolution strategy it won't detect the delcare module
statements if they're inside a file that has imports or exports at the top level. So, a bunch of older libraries were written in a way that doesn't work with this strategy. The "fix" for now seems to be to change moduleResolution
back to "node" ("node16"/"nodenext" also don't work for me). Based on my naive understanding of how "node" and "bundler" work, I think this is safe, since it seems like "bundler" is mostly just more flexible with its imports.
Discussed in https://github.com/vitejs/vite-plugin-vue2/discussions/81