mobxjs / mst-gql

Bindings for mobx-state-tree and GraphQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error using in Create-React-App

aminify opened this issue · comments

Hi Thanks for your efforts.
I just created a brand new react project using Create-React-App version 5.0.1.
Unfortunately after following the doc and scaffolding, when I tried to link my store to the app in my root index.tsx file, I get all these errors:

Attempted import error: 'print' is not exported from 'graphql' (imported as 'print').
ERROR in ./node_modules/mst-gql/dist/mst-gql.module.js 591:53-58
export 'print' (imported as 'print') was not found in 'graphql' (module has no exports)

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 25:0-49
Module not found: Error: Can't resolve './version' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'version.mjs'?
BREAKING CHANGE: The request './version' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 27:0-49
Module not found: Error: Can't resolve './graphql' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'graphql.mjs'?
BREAKING CHANGE: The request './graphql' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 29:0-40:50
Module not found: Error: Can't resolve './type' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './type' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 42:0-48:205
Module not found: Error: Can't resolve './language' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './language' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 50:0-122
Module not found: Error: Can't resolve './execution' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './execution' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 51:0-68
Module not found: Error: Can't resolve './subscription' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './subscription' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 53:0-56:206
Module not found: Error: Can't resolve './validation' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './validation' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 58:0-91
Module not found: Error: Can't resolve './error' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './error' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mst-gql/node_modules/graphql/index.mjs 60:0-97:42
Module not found: Error: Can't resolve './utilities' in '/Users/amin/Code/Edge/web/node_modules/mst-gql/node_modules/graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './utilities' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

webpack compiled with 10 errors

Hasn't anyone had this issue with CRA? Apparently this can be fixed with some change in the webpack config but I don't want to install additional libraries for modifying underlying webpack config and want to stick with CRA for this small project. I hope there is a straightforward solution for this.

commented

I was concentrating on a different TS build issue in my trial app, but you are right, it doesn't start and has the same errors as you said:

https://github.com/beepsoft/mst-gql-0.15.0-app

mst-gql uses an old graphql version ("14.6.0"), which probably does not work well with newer webpack.

commented

Indeed, upgrading the graphql package in mst-gql to "^16.3.0" and a little update to generate.js to use the new API fixes it. You can try my quick hack by using this in package.json this:

"mst-gql": "beepsoft/mst-gql#mst-gql-v0.15.0-graphql-upgrade-gitpkg",

Note that your project probably still won't start because of other errors: #361

Thank you. I'll try and investigate it a bit. Very sad that a great library like this doesn't work on latest build tools. This might disappoint newcomers from using it.

commented

I agree. Hope @jesse-savary will have more time to focus on this project in the future. I also try to help as much as I can (I am not maintainer).

commented

Hey, @jesse-savary! 0.15.0 is practically an unusable release and haven't heard of you for a week although I sent PR-s and try to @ mention you a couple of times. Any new user coming here to trying to use mst-gql just won't be able to do that and that's not good for the reputation of the project.

If you don't have the time or resources I am happy to help maintaining the project.

Apologies, thought the test suite was enough to catch any issues. I've not been able to test 0.15.0 internally with our own Hasura as of yet. This past week I've actually been trying to take it easy as I deal with what might be COVID however I'd appreciate any additional helping hands. Your past/current PRs are high quality and I meant to reach out previously.

@beepsoft what do you need outside of write access to the main branch? NPM publish perms?

commented

@jesse-savary, sorry for the light pressure but the current release is really unstable and needs the fixes. Hope you are doing well now! Could you please PM me on twitter to discuss the details? My handle is @ beepshow there. Thank you!

@beepsoft no worries, I asked for people to ping me if things were going off the rails :) I'm doing much better now and feel like myself again, thank you. I'll shoot you a message on Twitter once I setup an account purely for dev.

commented

Indeed, upgrading the graphql package in mst-gql to "^16.3.0" and a little update to generate.js to use the new API fixes it.

I will provide a PR for this as well and then hopefully a new release can be issued, which would work with eg. new CRA projects as well.