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

Defining an index.d.ts file in /plugins throws an error client-side #15387

Closed
TheDutchCoder opened this issue Nov 7, 2022 · 3 comments · Fixed by nuxt/framework#8787
Closed

Comments

@TheDutchCoder
Copy link
Contributor

Environment


  • Operating System: Darwin
  • Node Version: v16.15.1
  • Nuxt Version: 3.0.0-rc.12
  • Nitro Version: 0.6.0
  • Package Manager: npm@8.12.1
  • Builder: vite
  • User Config: hooks, app, build, experimental, imports, modules, nitro, runtimeConfig, typescript, vite
  • Runtime Modules: @nuxtjs/tailwindcss@5.3.3, nuxt-graphql-client@0.2.10, @vueuse/nuxt@9.3.0
  • Build Modules: -

Reproduction

N/A

Describe the bug

When following https://v3.nuxtjs.org/guide/directory-structure/plugins#typing-plugins

Nuxt throws an error in the browser:

Uncaught SyntaxError: The requested module '/_nuxt/plugins/index.d.ts?t=1667837951386' does not provide an export named 'default' (at client.mjs?t=1667837951386:6:8)

Irrespective of the contents of the file.

Placing the file anywhere else but /plugins doesn't provide typings.

Additional context

No response

Logs

No response

@TheDutchCoder
Copy link
Contributor Author

I think it's a documentation problem, where the example uses export {} instead of export default {}

@TheDutchCoder
Copy link
Contributor Author

TheDutchCoder commented Nov 7, 2022

I also think adding the index.d.ts file results in a [nuxt] Some plugins are not exposing a function and skipped warning. Not sure why a TS definitions file is being read :)

@danielroe
Copy link
Member

The example is correct, but the declarations shouldn't be imported at all.

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

Successfully merging a pull request may close this issue.

2 participants