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

Can't require on Node.js #5607

Closed
kraenhansen opened this issue Mar 22, 2023 · 0 comments · Fixed by #5608
Closed

Can't require on Node.js #5607

kraenhansen opened this issue Mar 22, 2023 · 0 comments · Fixed by #5608

Comments

@kraenhansen
Copy link
Member

kraenhansen commented Mar 22, 2023

How frequently does the bug occur?

Always

Description

Due to a misconfiguration of the package.json the ESM bundle is served when requiring from a CommonJS require statement.

Stacktrace & log output

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/kraen.hansen/Projects/realm-js/packages/realm/dist/bundle.node.mjs not supported.
Instead change the require of /Users/kraen.hansen/Projects/realm-js/packages/realm/dist/bundle.node.mjs to a dynamic import() which is available in all CommonJS modules.
    at __node_internal_captureLargerStackTrace (node:internal/errors:478:5)
    at new NodeError (node:internal/errors:387:5)
    at Module.load (node:internal/modules/cjs/loader:1031:11)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18) {
  code: 'ERR_REQUIRE_ESM'
}

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

v12.0.0-alpha.0

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Node.js

Build environment

No response

Cocoapods version

No response

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

Successfully merging a pull request may close this issue.

1 participant