-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
JS error at index.ts 36:8 browser-ponyfill.js #473
Comments
Having the same issue. |
Same here |
I'm not sure, but specifying shamefully-hoist=true in .npmrc might help. The sample at https://nuxt-graphql-client.web.app/getting-started/quick-start#preview is working with pnpm and specifies these options. ref: https://stackblitz.com/edit/nuxt-graphql?file=.npmrc cc: @Diizzayy |
That solves the issue. Might need to add explicit deps. |
As I know, Nuxt and Next are the both client and server hybrid solutions and cross-fetch supposed to be a replacement (ponyfill) for a fetch. But, it isn't. Because Ponyfills are new, separate functions that are used to replace native ones, and Polyfills are add functionality, that not existed in the environment. So, cross-fetch not only replaces the existed functionality, but also breaks types, expected behavior and add unexpected dependency. As a solution - replace cross-fetch with dummy empty package as mentioned here: Example:
|
Neither approach helped me with |
WorkaroundThe following solution from Pull Request #498 solved the problem for me. Add the following to the export default defineNuxtConfig({
// ...
vite: {
optimizeDeps: {
include: [
'nuxt-graphql-client > graphql-request' // Workaround for: https://github.com/Diizzayy/nuxt-graphql-client/issues/473
]
}
}
}); |
Environment
Describe the bug
Uncaught SyntaxError: The requested module '/_nuxt/node_modules/.pnpm/[email protected]/node_modules/cross-fetch/dist/browser-ponyfill.js?v=368afc8d' does not provide an export named 'default' (at index.ts:36:8)
Expected behaviour
No errors
Reproduction
No response
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: