-
Notifications
You must be signed in to change notification settings - Fork 147
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
"ReferenceError: require is not defined" in imported *.mjs file #696
Comments
Hi @btakita! This is by design to avoid providing a false sense of comfort with the state of experimental
If you're wanting better interop you'll want to use |
Thank you. I tried moving the I just don't see how the *.js & *.mjs interop would work. This does work with rollup & webpack, however. Is there any chance that we can have an option to relax the restriction for having edit: I have to call I can always use rollup for everything, however this is inconvenient when adding a one-off *.js script that loads *.mjs. |
Oh I meant you need to rename your |
Hey @jdalton this detailed information would be super-helpful on the README of esm and would save folks like me a lot of google searching and trying to understand why esm is treating .mjs files differently than expected. |
I'm not sure how to configure esm to keep
require
&module
defined in *.mjs files.I tried setting
{ cjs: true, force: true }
, but that does not seem to fix the error. I don't seem to understand the options & I tried almost every combination. What am I doing wrong?The text was updated successfully, but these errors were encountered: