-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ECMAScript module loading error #40
Comments
I was using vanilla |
I started the program also with |
Hang on, the fix is not working 😱 |
The issue is that this in the source works correctly for .mjs, but breaks in the .js: import graphql from 'graphql'
export const GraphQLUpload = new graphql.GraphQLScalarType({ … }) While this breaks the .mjs but works for the .js: import * as graphql from 'graphql'
export const GraphQLUpload = new graphql.GraphQLScalarType({ … }) Not sure if it is a Babel bug or what. |
Ok, maybe you can use a temporary solution with a mix of default and variable import like this one: And then you can add a conditional assignment like that: |
Related? babel/babel#6983 |
This should be fixed in v4.0.2. I'll continue to investigate a better solution. I've updated the example API to use native modules instead of |
Now, it works - thanks 👍 |
Thank you for your great package. I have one question:
When using the program with ESM (.mjs import) I get an error with the current version of Node (9.4.0).
The problem should be resolved by changing the following lines in
types.mjs
:I think GraphQL exports currently only with CJS and not yet with ESM and therefore there is only the "default export". Since you are running this program with Babel, you will not get an error. I use the package directly with Node.
https://nodejs.org/api/esm.html#esm_interop_with_existing_modules
The text was updated successfully, but these errors were encountered: