GithubHelp home page GithubHelp logo

Comments (10)

danielroe avatar danielroe commented on August 26, 2024 4

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/

CleanShot 2024-08-23 at 12 04 08@2x

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.

BobbieGoede avatar BobbieGoede commented on August 26, 2024 3

@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.

pavelimmobilien avatar pavelimmobilien commented on August 26, 2024 1

I can confirm that all .mjs imports in .nuxt/types/plugins.d.ts break type support for all provided plugins.

from nuxt.js.

danielroe avatar danielroe commented on August 26, 2024 1

@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.

antony-k1208 avatar antony-k1208 commented on August 26, 2024 1

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.

github-actions avatar github-actions commented on August 26, 2024

Stackblitz link for the reproduction: Stackblitz

from nuxt.js.

danielroe avatar danielroe commented on August 26, 2024

would you open in https://github.com/nuxt-modules/i18n instead? I think they plan a hotfix to address...

cc: @BobbieGoede

from nuxt.js.

frasza avatar frasza commented on August 26, 2024

Sure - nuxt-modules/i18n#3070. Thanks!

from nuxt.js.

Archetipo95 avatar Archetipo95 commented on August 26, 2024

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.

frasza avatar frasza commented on August 26, 2024

Solved with nuxt-modules/i18n#3071

from nuxt.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.