Graphql-js: [bug] does not work with @angular/[email protected]

Created on 10 May 2018  路  13Comments  路  Source: graphql/graphql-js

The core issue is the same as https://github.com/angular/angular-cli/issues/10744
I'm not sure the fix should be only in @angular-devkit- to me it seems reasonable to expect that graphql lib provide a .js main file.

There is an additional complication. After editing @angular-devkit trying to fix .mjs issue according to https://github.com/graphql/graphql-js/issues/1272#issuecomment-377384574, I'm getting the following error:

instanceOf.mjs:3 Uncaught ReferenceError: process is not defined
    at Object../node_modules/graphql/jsutils/instanceOf.mjs (instanceOf.mjs:3)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/graphql/type/definition.mjs (vendor.js:151316)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/graphql/type/validate.mjs (vendor.js:153362)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/graphql/graphql.mjs (vendor.js:146722)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/graphql/index.mjs (vendor.js:146842)
    at __webpack_require__ (bootstrap:81)

Most helpful comment

when is this expected to be released?

All 13 comments

This is a blocking issue for us. Is there any ETA for a fix?

@Ben305 It's issue with angular-cli that is already fixed see here:
https://github.com/angular/angular-cli/issues/10744#issuecomment-389078763

@amitport Since this issue already resolved by the change in angular-cli so can I close it?

@IvanGoncharov can we wait a couple of days until it will be included in some release? make sure everything is working OK together.

EDIT: I'm still getting the instanceOf.mjs:3 Uncaught ReferenceError: process is not defined part. This lib still doesn't work with Angular@6.

EDIT 2: this is an intentionally breaking change in Angular-CLI
https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814
"Browser code should not rely on things that are not available in browser environments."

(also related: https://github.com/angular/angular-cli/issues/10681#issuecomment-389160125)

can we wait a couple of days until it will be included in some release?

@amitport Sure 馃憤

I'm still getting the instanceOf.mjs:3 Uncaught ReferenceError: process is not defined part. This lib still doesn't work with Angular@6.

@amitport It looks like this was fixed in 60c03ab23852074896fd9134c24c46ba595bf014 but not released yet. Can you please run your test on master, you can use built version from here:
https://github.com/graphql/graphql-js#want-to-ride-the-bleeding-edge

Did work, though I got to say IMO it's missing the point made in https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814.

A library should not rely on a specific build tool, and in this case it relies on webpack to replace the process.env.NODE_ENV === 'production' block. In this specific case, I would remove the instanceof wrap entirely for the same reason Angular removed process wrap. Shouldn't hide the real problem which is with npm/yarn (a usability problem, not a bug). Plenty of other libs have the same concern.

This is not relevant to this issue though. Closing, thanks!

@amitport Can confirm this works with @angular/cli 6.0.3 and latest master branch. Can we get a new release on NPM please?

@Ben305 worked for me with @angular-devkit/[email protected] (Angular 6+ version is irrelevant) and graphql@master. 馃憤 for new graphql release (@leebyron ? not sure who should be tagged here :/ )

Maybe @mjmahone could also publish a new release with this fix

@Ben305 @amitport Update: @mjmahone working on 0.14.0 release, see here: https://github.com/graphql/graphql-js/pull/1346#issuecomment-391137211

when is this expected to be released?

I have update to graphql 14 and it solved the issue.

Yes, its a graphql issue, had the same problem with React@16, had to upgrade to graphql 14

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adriano-di-giovanni picture adriano-di-giovanni  路  3Comments

thomasdingemanse picture thomasdingemanse  路  4Comments

itajaja picture itajaja  路  3Comments

benjie picture benjie  路  4Comments

bhough picture bhough  路  3Comments