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

CLI: Add native support for ESM .mjs files on Node 12+ #1510

Merged
merged 2 commits into from
Nov 28, 2020
Merged

CLI: Add native support for ESM .mjs files on Node 12+ #1510

merged 2 commits into from
Nov 28, 2020

Conversation

Krinkle
Copy link
Member

@Krinkle Krinkle commented Nov 16, 2020

Ref #1465.

@Krinkle
Copy link
Member Author

Krinkle commented Nov 16, 2020

Note to self: Update TAP output to use a regex and make the following line optional so that Node 12 and 14 both pass:

(node:5775) ExperimentalWarning: The ESM module loader is experimental.\n

https://travis-ci.com/github/qunitjs/qunit/jobs/440548904
https://github.com/nodejs/node/blob/v14.15.0/doc/changelogs/CHANGELOG_V14.md#ecmascript-modules---experimental-warning-removal

Copy link
Contributor

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add support for .cjs files. Depending on your default setting in package.json you would either have to use .cjs or .mjs to use the other format (or to be explicit).

test/es2017/.eslintrc.json Outdated Show resolved Hide resolved
@Krinkle Krinkle force-pushed the esm branch 5 times, most recently from 38a534c to fdd01bc Compare November 18, 2020 01:17
* Rename test/es2017 and update ESLint config to allow for import/export
  syntax to be used. We don't rely on ESLint to know what is supported
  in Node.js, our test matrix in CI covers that already.

  We should probably re-think the way these tests are organized,
  which I've filed #1511 for.

* Update eslint config for src/cli to es2020. The dynamic `import()`
  statement was only spe'ced in es2020. This is first implemented
  (without experimental flag) in Node 12. We need to support Node 10.
  However it looks like Node 10 already tolerated this (maybe it sees
  it as a normal function, or maybe it was already recognised by the
  V8 parser it shipped with), so the try-catch suffices there.
  Again, the CI test matrix verifies for us that stuff works fine
  on older versions.

Ref #1465.
@Krinkle Krinkle merged commit 74c8855 into master Nov 28, 2020
@Krinkle Krinkle deleted the esm branch November 28, 2020 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants