Exporting as ES Module Syntax (ESM)
See original GitHub issuePlease, export "module" entry point in the package.json as ES Module Syntax (ESM).
More info about it here: https://www.pikapkg.com/about/
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:21 (17 by maintainers)
Top Results From Across the Web
module.exports and ES modules (ESM) import export in Node.js
import export syntax in ESM, export serves to export functions or objects from a module, and it has two types of export: Named...
Read more >ES Modules may not assign module.exports or exports.*, Use ...
I get this error when I try to export a function with module.exports and when I import it inside another file. I tried...
Read more >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 >export - JavaScript - MDN Web Docs
The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the ......
Read more >Using ECMAScript modules (ESM) with Node.js
Learn about using ES modules in Node.js today and get a closer look at how you ... We can only have one default...
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

I am running into this same issue with an app built using
apollo-client. It gives this error with Angular CLI version 10:https://angular.io/guide/build#configuring-commonjs-dependencies has some good links to explain why CommonJS modules don’t support tree shaking and how ES Modules work.
zen-observable-tsis importing correctly:But due to the lacking
"module": "esm.js", that ends up getting the CommonJS module (index.js) instead of the ES Module.It looks like the approach in PR https://github.com/zenparsing/zen-observable/pull/74 should solve this and hopefully avoid any of the pitfalls that were faced in the past.
Sounds cool - I’ll give it a try.