Open xiaoqf10 opened 5 years ago
I'm having a similar issue. Here's the pull request that gave me this error: https://github.com/colebemis/dasher/pull/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:
@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.
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
# import * from "./generated/prisma.graphql"