Export clean ESM modules
See original GitHub issueUsing graphql@14.2.1
/node_modules/graphql/jsutils/instanceOf.mjs line 16
// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
// See: https://webpack.js.org/guides/production/
export default process.env.NODE_ENV === 'production' ? // eslint-disable-next-line no-shadow
Uncaught ReferenceError: process is not defined
at instanceOf.mjs:16
The check process.env.NODE_ENV === 'production' breaks in the browser when using ESM version of graphql 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:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:12 (1 by maintainers)
Top Results From Across the Web
ECMAScript modules | Node.js v19.3.0 Documentation
Modules are defined using a variety of import and export statements. The following example of an ES module exports a function:
Read more >ECMAScript Modules - webpack
Webpack supports processing ECMAScript Modules to optimize them. Exporting. The export keyword allows to expose things from an ESM to other modules:
Read more >CommonJS vs. ES Modules: Modules and Imports in NodeJS
Export with ES Modules Instead of the require() function for importing modules, we now use a specific import syntax. Also, instead of a ......
Read more >What does it take to support Node.js ESM? – The Guild
exports is available, and since support for Node.js v10.x is dropped, everything should be fine and supporting ESM shouldn't be that hard. After ......
Read more >Building CJS module from ESM with mixed named and default ...
A default export is a named export, it's just named default . ESM is built so that if you don't specify a name,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Could the ESM exports use complete import paths ? e.g
Since this results in errors like
when using nodejs with ESM
Released as
15.0.0-rc.2. Last remaining issue tracked here: #2409