-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Compile issue with Rollup #1293
Comments
Just a follow up removing the mjs files fixes it, may be a similar issue to problems Webpack is having |
Removing the mjs files? |
I don't know, I'm also having issues with graphql-tools rollup. I'm working with Stencil (https://github.com/ionic-team/stencil) so I don't have access to the typescript and rollup configs to try and get it to work. I haven't setup a basic repo to replicate yet but I guess that would be the next step. |
Having this issue with rollup as well. It looks like with the new
My commonjs plugin looks like this to get around it (will try to get a pull request together if my emacs macro-foo is up for it):
|
I'd love to see a complete I arrived at a repro by doing the following:
This fails with:
Which implies that rollup is inadvertently looking at the - plugins: [resolve()]
+ plugins: [
+ resolve({
+ extensions: ['.mjs', '.js', '.json']
+ })
+ ] Now running Ideally |
Since rollup prefers ESM formatted modules, it should look for node's new .mjs file extension before looking for .js files by default. This offers support for deployed modules intended to be used in node's ESM mode. Folks can work around this today by manually supplying the `extensions` option, however it would be great if this worked by default. Note that looking for `.mjs` before `.js` is important for rollup which prefers ESM, however the `resolve` dependency should not use the same order by default since it is used in many other tools which do not yet support ESM or would not expect it by default. Encountered this as the root cause behind graphql/graphql-js#1293
The good news is that you can fix this yourself with very little effort - just modify your |
@leebyron first of all, thanks for digging into this. It looks like more of a rollup issue than a graphql, so I appreciate it you taking it to the mattresses and finding a solution. For some reason, my rollup config edited like yours to prefer
Your pull request to rollup I hope gets accepted and fixes the secondary (recursive) module resolution to use index.mjs and then life is roses and daisies again. |
Lee PR was merged but AFAIK not released yet so I don't see anything else we can do in |
Changes from PR are in current release of
Error does go away if I define a very long |
I ran into this problem, as well. Adding // Nice and alphabetical...but wrong
resolve({ extensions: ['.es', '.es6', '.js', '.jsx', '.mjs', '.ts', '.tsx'] }) I did resolve({ extensions: ['.mjs', '.es', '.es6', '.js', '.jsx', '.ts', '.tsx'] }) and only then did the error go away. |
Looks like the way index.js handles it's exports rolllup can't find it
{ Error: 'GraphQLObjectType' is not exported by node_modules/graphql/type/index.js
at error (/Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:168:15)
at Module.error (/Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:17602:9)
at handleMissingExport (/Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:17863:12)
at /Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:19512:56
at Array.reduce (native)
at Graph.handleMissingExport (/Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:19511:27)
at Module.traceExport (/Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:17720:28)
at Module.trace (/Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:17695:43)
at ModuleScope.findVariable (/Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:14890:28)
at Scope.findVariable (/Users/Corey/Documents/workspace/mkr/node_modules/rollup/dist/rollup.js:11840:68)
code: 'MISSING_EXPORT',
url: 'https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module',
pos: 1383,
loc:
{ file: '/Users/Corey/Documents/workspace/mkr/node_modules/graphql/index.mjs',
line: 41,
column: 19 },
frame: '39: export { GraphQLSchema,\n40: // Definitions\n41: GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull, GraphQLDirective,\n ^\n42: // "Enum" of Type Kinds\n43: TypeKind,' }
[ ERROR ] bundling: node_modules/graphql/index.mjs, line: 41
'GraphQLObjectType' is not exported by node_modules/graphql/type/index.js
The text was updated successfully, but these errors were encountered: