Module not found: Can't resolve 'graphql'
Unanswered
Pink salmon posted this in #help-forum
Pink salmonOP
I suddenly started having this issue when using next dev --turbo. it works in non turbo. I suspect it has to do with recent update with recent msw update to v2.4.1
⨯ ModuleBuildError: ./node_modules/.pnpm/msw@2.4.1_typescript@5.5.4/node_modules/msw/lib/core/utils/internal/parseGraphQLRequest.mjs:15:27
Module not found: Can't resolve 'graphql'
13 | }
14 | async function parseQuery(query) {
> 15 | const { parse } = await import("graphql").catch((error) => {
| ^^^^^^^^^^^^^^^^^
16 | devUtils.error(
17 | 'Failed to parse a GraphQL query: cannot import the "graphql" module. Please make sure you install it if you wish to intercept GraphQL requests. See the original import error below.'
18 | );5 Replies
Pink salmonOP
installing graphql as dev dependency fixed it but its not ideal. not sure if a pnpm issue.
@Pink salmon installing graphql as dev dependency fixed it but its not ideal. not sure if a pnpm issue.
Nile Crocodile
It seems like GraphQL is being used at runtime, and in this case, is the dependency added as non-dev but actual one (i.e.
dependencies in :/package.json). If it is, is it installed at this point in the scope of the project, or is it supposed to be installed globally?Pink salmonOP
only happens in turbo mode. it does work before without graphql as devDependencies but suddenly its not working.
so I assume the next —turbo uses the graphql and something broke when msw made an update
it happens on runtime at turbo mode since it only appears when you visit a page