-
Notifications
You must be signed in to change notification settings - Fork 20
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
Error "The package may have incorrect main/module/exports specified in its package.json." #152
Comments
This package is type-only package, and does not include any code. |
@dotansimha Should be supported by bob. 🤔 https://github.com/kamilkisiela/bob/pull/144/files#diff-691ec73579d989528bc5e4a7db013c029b3c478b3360d962ad5548a0ce42d1c1 I'll have a look. |
Hey @joulev, thanks for reporting this! However, I have not been able to replicate this - I'll keep trying but in the meantime; have you tried a clean install (remove node_modules recursively and run install again)? Maybe share more info like the package.json, or ideally a repro? |
@enisdenjo Thanks for the reply. I retried just now with all My repo is a SvelteKit Vite app, where this package is used as part of GraphQL codegen; it's available here if you want a repro repo right now, but since it's a monorepo I will create a repro repo as minimal as possible instead, and will get back to you in a few hours. |
Thank you very much! That will help out definitely. In the meantime, I will try out a few things. 👍 |
Sorry as it might not be as minimal as you expected it to be, but I am not confident enough to make it any more minimal. For the repo, if you run |
Vite is having issues importing @graphql-typed-document-node/core as a value, it worked with v3.1.1 because there we had an empty file that we used for value imports - but this changes. Am looking into ways of handling this. A proper approach would also be to use type imports for type-only modules, I made a PR here: joulev/debug#1. |
Thank you, it worked. (Don't worry about the deployment failure; it was because I didn't configure Vercel to build SvelteKit in that repo.) Since I intend to keep the debug repo as-is so future people can come to this issue and see the reproduction repo as when it was reported, I think I will close your PR and commit to the main repo instead (see above). |
The plugin "vite:dep-scan" was triggered by this import
I started to get this error as well. I have no idea what happened but it worked many month and stopped |
you can try adding an exclusion rule for the @graphql-typed-document-node/core package in your Vite configuration. vite.config.js It will help till this package will be fixed or vite will be fixed
|
For pnpm:
https://the-guild.dev/graphql/codegen/docs/guides/react-vue#installation |
I have the same also using Sveltekit + Vite. Both #152 (comment) and #152 (comment) do not work. It does seem that #152 (comment) works though. |
Using import type { CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = {
overwrite: true,
schema: 'src/lib/schema.graphql',
documents: 'src/**/*.ts',
generates: {
'src/lib/gql/': {
preset: 'client',
plugins: [],
config: {
useTypeImports: true // The updated setting.
}
}
}
}
export default config It fixed the problem with Vite. |
[email protected] + [email protected] configured with tsconfig.json {
"compilerOptions": {
"module": "ESNext",
"verbatimModuleSyntax": true,
}
} Refuses to build with this error
Enabling export default defineConfig({
// ...
optimizeDeps: {
exclude: ['@graphql-typed-document-node/core'],
},
} Would it be possible to perhaps re-add the empty JS main file back into the repository? |
Same problem here with Vite v5.1.5 / Vue3
Doesn't work for me either
Also that fix doesn't work for my setup |
I'm hitting the same problem when building an app with vite:
I already had Removing Adding the I also tried installing @graphql-typed-document-node/core v3.1.1, but it seems like for this to be compatible with GraphQL Code Generator I'd also have to revert to a significantly older version of their client preset (and possibly other packages). Summing up: removing @enisdenjo Echoing @mogelbrod: would it be possible to readd the empty JS file until some other solution is found? |
I have the same problem here with Vite 5.2.8 and Vue3
|
After I migrate from |
I tried to upgrade my app to use v3.1.2, but without any other code changes, the following error shows up on build:
Call stack
The text was updated successfully, but these errors were encountered: