I’ve never had an error like this before… does anyone know how to fix this?
Tobbe
July 15, 2020, 9:58am
2
What file is giving you this error? Can you give us the full filepath and also show what the file looks like?
What steps did you take before getting this error?
If you could provide a little more context I’m sure someone here has some ideas how to troubleshoot further
../node_modules/graphql/index.mjs 42:0-48:205Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available)
All i had done was create an apollo schema in the frontend
I can confirm that it has nothing to do with the gql imports. Maybe it has something to do with Webpack?
Tobbe
July 15, 2020, 10:01pm
6
Thanks for getting back with more details
I’m afraid I don’t have any good guesses as to what might be wrong. Hopefully someone else can chime in
You may already seen this:
opened 11:01AM - 05 Mar 18 UTC
closed 09:21PM - 18 Apr 18 UTC
Hi,
After updating to webpack 4, compiling graphiql doesn't work because of t… he graphql-js dependency.
I get a bunch of those errors:
```
ERROR in ./node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphql' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
ERROR in ./node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphqlSync' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'DEFAULT_DEPRECATION_REASON' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLBoolean' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLDeprecatedDirective' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
```
(and a million more)
Seems like forcing the downgrade to a graphql-js version that doesn't have .mjs files fixes the issue.
Did you add some to your web/config/webpack.config.js
?
or this
opened 11:01AM - 05 Mar 18 UTC
closed 09:21PM - 18 Apr 18 UTC
Hi,
After updating to webpack 4, compiling graphiql doesn't work because of t… he graphql-js dependency.
I get a bunch of those errors:
```
ERROR in ./node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphql' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
ERROR in ./node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphqlSync' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'DEFAULT_DEPRECATION_REASON' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLBoolean' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLDeprecatedDirective' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql/index.mjs
@ ./node_modules/graphiql/dist/components/GraphiQL.js
@ ./node_modules/graphiql/dist/index.js
@ ./src/client/apps/graphiql/graph-viewer/index.js
@ ./src/client/apps/graphiql/app.js
@ ./src/client/apps/graphiql/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server webpack-dev-server/client?http://localhost:8080 webpack/hot/only-dev-server ./src/client/apps/graphiql
```
(and a million more)
Seems like forcing the downgrade to a graphql-js version that doesn't have .mjs files fixes the issue.
Had the same issue, but I didn't want to mess with webpack config. My fix was to change imports.
-import { print } from 'graphql';
+import { print } from 'graphql/language/printer';
I figured out what the issue is, and i can only say I’m more confused than before.
It’s webpack, not detecting .mjs files. A patch was released for this a year ago, but for some reason my file doesnt have that config. Does anyone know how to edit a webpack file and add that in? I have no personal experience with it.
Also just realized… I don’t have a webpack file in my web config.