Support ES modules with `@std/esm`
See original GitHub issueSupport ES modules with @std/esm
PR used in this proposal: https://github.com/Turfjs/turf/pull/975
Using @std/esm
seems to work perfectly with NodeJS (4+ compatible) and works well with our tape
testing suite, ~unfortunately… it doesn’t like it when you use .js
for ES Modules~ (Added @std/esm
to fix this)
SyntaxError: 'import' and 'export' may only be used in ES modules
~😢 … Going to refactor everything back to .js
=> .mjs
(dropping .es5.js
files) once this is done, a fresh git clone would be required.~
🥇 Easy to use
When @std/esm
is included as a devDependency, you can easily execute the tape
tests using the following:
$ node -r @std/esm test.js
$ node -r @std/esm bench.js
$ node -r @std/esm index.js
🎉 🚀 Omg…! No Rollup pretest was required for this test to run successfully.
Publishing
The Rollup pretest
will be changed to => prepublish
to transpile the index.js
(ES Modules) => dist/index.js
(CommonJS) before publishing a new release.
❌ Not happening
- No Babel on index files
- No Rollup on test files (tests can be ES Modules or CommonJS 🎉 )
This is such a pain 😢 … (it will be worth it at the end of this madness)
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Steam - DCS World
How to transfer keyless DCS modules purchased on STEAM? Steam modules are not authorized; How do I add command line arguments to a...
Read more >Question: Plans for Node.js ESM Module Support? #1946
Has there been any talk about how the Node side of the project is going to address to coming ESM/ES6 module migration that...
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
I'm trying to make a Discord bot that just says if someone is online on the game. However I keep getting this message:...
Read more >Steam Transfers now available via DCS Account Profile
How to transfer keyless DCS modules purchased on STEAM? Please note, all future DCS World DLC released on Steam from 12th May 2017...
Read more >How to Use ECMAScript Modules With Node.js - How-To Geek
The simple answer is yes. ES Modules are the standardized way to import and export JavaScript code. CJS gave Node a module system...
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
@jdalton Sorry for the 17+ day response, I still haven’t forgotten about your comment. As for feedback, so far
@std/esm
is working out just great!I’ll make sure to send some feedback on
@std/esm
issues, so far it looks great! 👍🍻