Comments (10)
The issue is that the wrong declarations are generated - see:
https://unpkg.com/browse/@nuxt/[email protected]/dist/runtime/plugins/ and https://unpkg.com/browse/@nuxtjs/[email protected]/dist/runtime/plugins/
This should be devtools.server.d.ts
and devtools.server.js
OR devtools.server.d.mts
and devtools.server.mjs
.
Investigating to see whether this is a module-builder issue.
from nuxt.js.
@danielroe
This seems to be caused by type imports in plugins.d.ts
, it breaks whenever imports use .mjs
instead of .js
.
I was able to reproduce this locally (using the provided repo) without @nuxtjs/i18n
, the types added by @nuxt/devtools
when running nuxt dev will cause the same issue.
Is this something that should be resolved on the module end or on Nuxt's side?
For completeness sake, here's the types in plugins.d.ts
when running nuxt dev:
type NuxtAppInjections =
InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/revive-payload.client.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/head/runtime/plugins/unhead.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/pages/runtime/plugins/router.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/navigation-repaint.client.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/check-outdated-build.client.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/revive-payload.server.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/chunk-reload.client.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/pages/runtime/plugins/prefetch.client.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/pages/runtime/plugins/check-if-page-unused.js").default> &
// note the file extensions - commenting out these lines will fix the types
InjectionType<typeof import("../../node_modules/@nuxt/devtools/dist/runtime/plugins/devtools.server.mjs").default> &
InjectionType<typeof import("../../node_modules/@nuxt/devtools/dist/runtime/plugins/devtools.client.mjs").default> &
InjectionType<typeof import("../../node_modules/@nuxtjs/i18n/dist/runtime/plugins/switch-locale-path-ssr.mjs").default> &
InjectionType<typeof import("../../node_modules/@nuxtjs/i18n/dist/runtime/plugins/i18n.mjs").default> &
// end of file extensions to comment out
InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/dev-server-logs.js").default> &
InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/check-if-layout-used.js").default> &
InjectionType<typeof import("../../plugins/http").default>
from nuxt.js.
I can confirm that all .mjs
imports in .nuxt/types/plugins.d.ts
break type support for all provided plugins.
from nuxt.js.
@Archetipo95 The issue might be that the version of @docsearch/react
used in the module did not expose correct types for TypeScript bundle module resolution. You could file an issue upstream on https://github.com/nuxt-modules/algolia.
from nuxt.js.
I am not sure if this is related to the issue, but I am facing similar Typescript errors after upgrading to Nuxt 3.13.0.
Since then all the provided data from plugins is not available anymore, when using useNuxtApp
: https://stackblitz.com/edit/nuxt-3-13-0-plugin-provide-issue.
Just by changing the Nuxt version back to 3.12.4 the type error disappears.
from nuxt.js.
Stackblitz link for the reproduction: Stackblitz
from nuxt.js.
would you open in https://github.com/nuxt-modules/i18n instead? I think they plan a hotfix to address...
cc: @BobbieGoede
from nuxt.js.
Sure - nuxt-modules/i18n#3070. Thanks!
from nuxt.js.
I think I had a related issue this morning with algolia nuxt module
../../node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected]_gmv53hnb7zexxkglosjulg7kzy/node_modules/@nuxtjs/algolia/dist/runtime/components/AlgoliaDocSearch.vue:10:60 - error TS2307: Cannot find module '@docsearch/react' or its corresponding type declarations.
Unfortunately I don't have a reproduction and my fix was to remove the algolia module because was no longer used
from nuxt.js.
Solved with nuxt-modules/i18n#3071
from nuxt.js.
Related Issues (20)
- routeRules proxy omits Content-Encoding header HOT 3
- Async/Await in router.options.ts with a nuxt composables breaks the app HOT 6
- Error deploying NUXT 3 application on IIS server
- useFetch doesn't convert Date to string HOT 4
- Add `#shared` alias
- Deploy production without node_modules directory HOT 2
- Server side useCookie problem HOT 1
- Potential Memory Leak HOT 4
- dynamic route is not found ! HOT 2
- Nuxt Plugin "provide" is not typed automatically since v3.13.0 HOT 7
- future: { compatibilityVersion: 4 } Messes up some types HOT 2
- serverDir not being registered HOT 3
- Client chunk too large with experimental.componentIslands.selectiveClient (to true) and @nuxt/client HOT 1
- runtime config in `.env` is not loaded in production HOT 2
- Error parsing JavaScript expression: Expecting Unicode escape sequence \uXXXX HOT 4
- Make server routes aware of page routes to avoid collisions HOT 1
- Nuxt middleware performs undefined behaviour when protecting routes HOT 2
- Property X does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>> HOT 2
- `useRoute.matched` is always returning 1 item - in future compatibilityVersion 4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.js.