graphql-import can not find "prisma.graphql" file in now.( I use now2.0 @now/node builder)
xiaoqf10 opened this issue · 3 comments
# import * from "./generated/prisma.graphql"
I'm having a similar issue. Here's the pull request that gave me this error: colebemis/dasher#13
Here's the error message I'm getting:
{ Error: Cannot find module './src/generated/prisma/prisma.graphql'
at Function.Module._resolveFilename (module.js:547:15)
at resolveFileName (/var/task/user/backend/src/index.ts:187758:39)
at resolveFrom (/var/task/user/backend/src/index.ts:187772:9)
at module.exports.module.exports (/var/task/user/backend/src/index.ts:187775:41)
at resolveModuleFilePath (/var/task/user/backend/src/index.ts:137399:24)
at /var/task/user/backend/src/index.ts:137436:30
at Array.forEach (<anonymous>)
at collectDefinitions (/var/task/user/backend/src/index.ts:137434:16)
at importSchema (/var/task/user/backend/src/index.ts:137322:14)
at Module.<anonymous> (/var/task/user/backend/src/index.ts:203074:85) code: 'MODULE_NOT_FOUND' }
Here's my now.json
:
{
"version": 2,
"name": "dasher",
"alias": ["dasher.sh"],
"builds": [
{ "src": "backend/src/index.ts", "use": "@now/node-server@canary" },
{ "src": "frontend/next.config.js", "use": "@now/next" }
],
"routes": [
{ "src": "/api", "dest": "/backend/src/index.ts" },
{ "src": "/(.*)", "dest": "/frontend/$1" }
],
"env": {
"API_ENDPOINT": "/api"
}
}
I'm using graphql-import@0.7.1
.
I think this issue is related to:
- https://spectrum.chat/?t=71053e4b-c98a-4d97-90c7-8b69f8dcf513
- https://www.prisma.io/forum/t/graphql-import-can-not-find-prisma-graphql-file-in-now-i-use-now2-0-now-node-builder/5487/5.
@paulogdm might be able to help 🤞
@colebemis My current solution is, use "graph-import" locally to generate a combined "graphql" file before deployment.
For anyone having issues with this, I have been trying for days and I've found a solution.
Do not use graphql-import
it is completely broken at the minute.
Solution
Simply use the babel-plugin-import-graphql
It reads the # import syntax within .graphql files (and even .gql files) recursively and builds one giant string, without webpack.
To which you can pass to your schema builder