graphql-framework-experiment
graphql-framework-experiment copied to clipboard
Nexus won't start after build (missing nexus/dist/index.js)
Nexus Report
{
"node": "v13.12.0",
"os": {
"platform": "darwin",
"release": "19.5.0"
},
"nexus": "^0.26.0-next.5",
"plugins": [
"nexus-plugin-prisma"
],
"otherDependencies": {
"@types/cookie-session": "^2.0.41",
"@types/cors": "^2.8.6",
"@types/csurf": "^1.9.36",
"@types/graphql-upload": "^8.0.3",
"@types/node": "^14.0.23",
"@types/pluralize": "0.0.29",
"apollo-server-errors": "^2.4.2",
"aws-sdk": "^2.716.0",
"cookie-session": "^1.4.0",
"cors": "^2.8.5",
"crypto-random-string": "^3.2.0",
"csurf": "^1.11.0",
"googleapis": "^55.0.0",
"graphql-upload": "^11.0.0",
"hijackresponse": "^4.0.0"
},
"devDependencies": {
"prettier": "^2.0.5"
},
"hasAppModule": true,
"packageManager": "npm",
"errorsWhileGatheringReport": {
"gettingLayout": null,
"gettingPluginManifests": null
}
}
Description
npm run build
works fine, but upon npm start
I get this error:
tsbackend bkrausz$ npm start
> [email protected] start .../tsbackend
> node .nexus/build/api
internal/modules/cjs/loader.js:326
throw err;
^
Error: Cannot find module '.../tsbackend/.nexus/build/node_modules/nexus/dist/index.js'. Please verify that the package.json has a valid "main" entry
.nexus/build/node_modules/nexus
only contains (dist/)?components/schema
and a package.json
(almost like it's incorrectly tree-shaking).
I've tried blowing away .nexus
and node_modules
.
This works in v0.25.0, just not in next
I have the same kind of problem - .nexus/build/node_modules
is almost empty and npm start
fails when it can't find the Prisma plugin framework-entrypoint.js
. nexus-plugin-prisma
directory is there, but depending on the version it only contains the schema-entrypoint
or nothing at all. v0.25.0 works but not next.
Any update on this or idea where I could dig? The TS compilation code is a lot to dig through/diffing didn't produce anything obvious, but I'm very excited for the apollo-server switch (batch + file uploads) and would like to switch to next
ASAP if I can resolve this.
BTW I tried on -next
a few days ago and it was still happening.
Aha...I figured out what it is! Importing from @nexus/schema
or nexus/components/schema
causes the issue. I was doing import { arg } from "nexus/components/schema";
instead of using schema.arg
.
That is...very unintuitive. It'd be great to have a lint rule or similar to prevent the issue.