-
Notifications
You must be signed in to change notification settings - Fork 2k
Export clean ESM modules #1819
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
Comments
Also related but different: apollographql/graphql-tag#229 |
Hello, Id like to try to help with this issue. Using Unbundle, do you have a possibility to differentiate production from development code? I could not find a way to do it without using "bundlers". If there is not, the main issue, is that this export returns an optimized function for production, so that in the absence of the process.env, there is a choice to make about using the optimized function or the more helpful for development function. Any thoughts on this? |
Not sure if this will get any traction before Node 12 drops the --experimental-modules flag, because they've asked the community to not publish any ES modules until then. |
Compromise: Publish a distinct ESM package on NPM. Avoids conflict with Node.js and is backwards compatible with a variety of bundlers. E.g. lodash-es Caveat, I'm not familiar with the reasons behind the above statement. Maybe this idea would cause problems in the long run. 🤷🏼♂️ |
Any news here? Thanks in advance! |
Could the ESM exports use complete import paths ? - export { Source } from './source';
+ export { Source } from './source.mjs'; Since this results in errors like
when using nodejs with ESM |
@Banou26 to achieve that, For example, here it is in action with
|
@jaydenseric what is i want to use the raw npm content without further bundling either from node or the browser than the content must be 100% valid esm with full file names. |
but deep inside there are still some imports without extension Error: Cannot find module /Users/markus/build/hook-ci/node_modules/graphql/jsutils/devAssert imported from /Users/markus/build/hook-ci/node_modules/graphql/utilities/buildASTSchema.mjs |
Thanks @jaydenseric, |
Released as |
Using [email protected]
/node_modules/graphql/jsutils/instanceOf.mjs
line 16The check
process.env.NODE_ENV === 'production'
breaks in the browser when using ESM version ofgraphql
package. Is it possible to remove before publishing to NPM? Without it the ESM files work perfectly.I am not using Webpack/RollUp/Babel. Simply copying the ESM files from node_modules to my frontend folder using unbundle.
Related but different:
The text was updated successfully, but these errors were encountered: