Eliminate the need for babel loader by supporting ES Modules natively #1553
Labels
🏦 debt
Tech debt
♊ duplicate
Duplicate of another issue
🔧 build
Related to build / release process
⚡ enhancement
Request for new functionality
I have a Discord bot that I am E2E testing using cucumber-js. The bot runs on Node 14 LTS and does not use transpilation of any kind. The only thing I need
@babel/loader
is so I can write my tests using modern ES code. The additional config and requirement of Babel, as well as the other drawbacks such as having to debug with source maps, is a prime example of tooling getting in the way of writing code. Jest already has an experimental command line switch allowing native modules, and it should be easier for cucumber-js because I don't think a custom loader would be necessary.From a cursory glance at cucumber-js's code, I think it should be relatively straightforward to get ES modules working with the following improvements, while retaining compatibility with older Node versions:
require()
in the codebase toawait import()
.import()
can import Common JS modules, butrequire()
cannot import ES modules.cucumber-esm.mjs
file to/bin
that imports and runs cucumber.Is there anything I might have missed that would make this more complicated?
The text was updated successfully, but these errors were encountered: