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

1.14.0 breaks CommonJS imports #210

Closed
noomorph opened this issue Jan 21, 2023 · 4 comments · Fixed by #211
Closed

1.14.0 breaks CommonJS imports #210

noomorph opened this issue Jan 21, 2023 · 4 comments · Fixed by #211

Comments

@noomorph
Copy link

Describe the bug

Cannot run this code: require('eta').

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/yaroslavs/Projects/wix/Detox/website/node_modules/eta/dist/eta.umd.js from /Users/yaroslavs/Projects/wix/Detox/website/[eval] not supported.
eta.umd.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename eta.umd.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/yaroslavs/Projects/wix/Detox/website/node_modules/eta/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

To Reproduce

Steps to reproduce the behavior:

mkdir repro
cd repro
npm init -y
npm install eta --save-dev
node -p "require('eta')"

Expected behavior

It should run without errors and return an object, like the version 1.13.0.

Screenshots

eta@1.13.0 eta@1.14.0
before after

Package & Environment Details

  • Environment: Node.js (14, 16, 18)
  • Version: eta@1.14.0

Additional context

There was a similar issue here: nebrelbug/npm-to-yarn#30

See how it was resolved: nebrelbug/npm-to-yarn@4a13cc8

@gurgunday
Copy link
Contributor

This is an easy fix and a possible remedy is to stay at 1.13. Sorry for the problem – update will be released ASAP!

nebrelbug pushed a commit that referenced this issue Jan 21, 2023
Co-authored-by: Gün <Gün>
Closes #210
@nebrelbug

This comment was marked as resolved.

@allcontributors

This comment was marked as resolved.

@nebrelbug
Copy link
Collaborator

@noomorph we just released a new patch version, 1.14.1, which should solve the issue! Let us know if you continue to have problems!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants