Skip to content
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

Eliminate the need for babel loader by supporting ES Modules natively #1553

Closed
andyearnshaw opened this issue Jan 28, 2021 · 1 comment
Closed
Labels
🏦 debt Tech debt ♊ duplicate Duplicate of another issue 🔧 build Related to build / release process ⚡ enhancement Request for new functionality

Comments

@andyearnshaw
Copy link

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:

  • Switch uses of require() in the codebase to await import(). import() can import Common JS modules, but require() cannot import ES modules.
  • Introduce a second compile step from TypeScript to a version of JS compatible with Node 14 LTS
  • Add a cucumber-esm.mjs file to /bin that imports and runs cucumber.

Is there anything I might have missed that would make this more complicated?

@aslakhellesoy aslakhellesoy added 🔧 build Related to build / release process ⚡ enhancement Request for new functionality 🏦 debt Tech debt labels Feb 2, 2021
@davidjgoss davidjgoss added the ♊ duplicate Duplicate of another issue label Feb 25, 2021
@davidjgoss
Copy link
Contributor

Closing as a dup of #1304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏦 debt Tech debt ♊ duplicate Duplicate of another issue 🔧 build Related to build / release process ⚡ enhancement Request for new functionality
Projects
None yet
Development

No branches or pull requests

3 participants