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

CommonJS require fails because of improper exports order #118

Closed
kyle-johnson opened this issue Jan 24, 2021 · 0 comments
Closed

CommonJS require fails because of improper exports order #118

kyle-johnson opened this issue Jan 24, 2021 · 0 comments

Comments

@kyle-johnson
Copy link

Description

CommonJS (cjs) import no longer works. Try from a node v14+ REPL

> const nd = require("normalize-diacritics")
Uncaught:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: 

Expected outcome

No error on CJS import.

Actual outcome

ERR_REQUIRE_ESM

Fix

Per conditional export docs, order matters: place "default": "./dist/index.mjs" at the end of the list and everything works!

Versions of affected system

  • normalize-diacritics version: 2.13.1
  • Node.js version: 14.15.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants