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

CJS version of mimetext@3.0.19+ can't be imported, ESM issues #63

Closed
s100 opened this issue Feb 13, 2024 · 8 comments · May be fixed by #66
Closed

CJS version of mimetext@3.0.19+ can't be imported, ESM issues #63

s100 opened this issue Feb 13, 2024 · 8 comments · May be fixed by #66

Comments

@s100
Copy link

s100 commented Feb 13, 2024

Do the following:

npm install mimetext
node
require('mimetext')

And I see:

var _MIMEMessage = require("../MIMEMessage.js");
                   ^
Uncaught:
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\...\node_modules\mimetext\build\MIMEMessage.js from C:\...\Downloads\node_modules\mimetext\build\entrypoints\node.cjs not supported.
Instead change the require of MIMEMessage.js in C:\...\Downloads\node_modules\mimetext\build\entrypoints\node.cjs to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (C:\...\Downloads\node_modules\mimetext\build\entrypoints\node.cjs:42:20)
    at REPL1:1:1
    at Script.runInThisContext (node:vm:123:12)
    at REPLServer.defaultEval (node:repl:569:29)
    at bound (node:domain:433:15)
    at REPLServer.runBound [as eval] (node:domain:444:12)
    at REPLServer.onLine (node:repl:899:10)
    at REPLServer.emit (node:events:526:35)
    at REPLServer.emit (node:domain:489:12)
    at REPLServer.self._ttyWrite (node:repl:994:9)
    at ReadStream.emit (node:events:514:28)
    at ReadStream.emit (node:domain:489:12)
    at emitKeys.next (<anonymous>)
    at ReadStream.emit (node:events:514:28)
    at ReadStream.emit (node:domain:489:12) {
  code: 'ERR_REQUIRE_ESM'
}

Seems as if build/entrypoints/node.cjs is requireing build/MIMEMessage.js when it should be requireing build/MIMEMessage.cjs.

mimetext@3.0.18 worked.

@muratgozel
Copy link
Owner

hey, what is your node version?

@s100
Copy link
Author

s100 commented Feb 13, 2024

18.17.1.

@esakkirajaravenantech
Copy link

we have the same problem, using node version v19.9.0, we need help

@Nexus-coder
Copy link

Have the same problem as this how do i fix?

@s100
Copy link
Author

s100 commented Feb 20, 2024

Current workaround is to pin to mimetext@3.0.18.

@Nexus-coder
Copy link

Thanks its worked

@esakkirajaravenantech
Copy link

Thanks. Its worked.

@muratgozel
Copy link
Owner

all typings should be working as of v3.0.23, closing this issue for now.

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.

4 participants