Describe the bug
After upgrading to TypeScript 3.9.2, Nuxt.js can't resolve modules. Error looks like:
This dependency was not found:
* nuxt_plugin_compositionapi_1a0c1998 in ./.nuxt/index.js
However, even if you disable the plugins, it can't build .vue files.
Additional context
If you downgrade to 3.8.3, then everything works.
Indeed this is the case - @nuxt/typescript-build has a dependency of "~3.8".
There are a LOT of issues with TS 3.9.x as they made subtle changes to how import works. In our case this was related to a 'broken' TSLIB being includes. AFAIK Nuxt uses it's own resolver and might not be compatible (yet).
related links: https://github.com/microsoft/tslib/pull/109
TypeScript minor releases often break projects, it has been the case of Vue.js types few times.
That's why I pinned Nuxt TypeScript packages to a specific TypeScript minor version.
TypeScript 3.9 is pretty new, and if you check their releases, 3.9.0 & 3.9.1 have only been respectively Beta & Release Candidate (RC) versions.
So official release of 3.9 is 3.9.2 which is only 2 days old.
I'd recommend to not install 3.9 for now, cause we don't know how big is the impact of the 3.9.2 changes regarding imports.
I use the monorepo approach, server build has actually become faster. But my front-end also depends of TypeScript. This is the only reason I'm waiting for this release. Then it remains only to wait.
I use the monorepo approach, server build has actually become faster. But my front-end also depends of TypeScript. This is the only reason I'm waiting for this release. Then it remains only to wait.
We also have monorepo with api / nuxt / other. we compile api with 3.9.2 , nuxt with 3.8.3. no issue as source code is same / shared. Based on looking at all the issues being reported with 3.9.2 doesn't suprise me kevin is waiting a bid to spent time on it...
fwiw, it can happen that you have typescript 3.9 pulled by another dependency. I had an hello world experience with nuxt broken out of the box simply because I ended with typescript package 3.9.3 in my project node_modules. Simply create-nuxt-app, tried to run dev and got "Module not found: Error: Can't resolve 'ts-loader'".
It took me some time to figure out that @nuxt/typescript-build depends explicitely on typescript <= 3.9 and I had to pin to [email protected] .
fwiw, it can happen that you have typescript 3.9 pulled by another dependency. I had an hello world experience with nuxt broken out of the box simply because I ended with typescript package 3.9.3 in my project node_modules. Simply create-nuxt-app, tried to run dev and got "Module not found: Error: Can't resolve 'ts-loader'".
It took me some time to figure out that @nuxt/typescript-build depends explicitely on typescript <= 3.9 and I had to pin to [email protected] .
Working with node i make sure every package (that i control) is set to specific version - cannot rely on everyone to ensure the semantic versioning actually works :)
Most helpful comment
TypeScript minor releases often break projects, it has been the case of Vue.js types few times.
That's why I pinned Nuxt TypeScript packages to a specific TypeScript minor version.
TypeScript 3.9 is pretty new, and if you check their releases, 3.9.0 & 3.9.1 have only been respectively Beta & Release Candidate (RC) versions.
So official release of 3.9 is 3.9.2 which is only 2 days old.
I'd recommend to not install 3.9 for now, cause we don't know how big is the impact of the 3.9.2 changes regarding imports.