-
Notifications
You must be signed in to change notification settings - Fork 156
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
dateformat not working with "require" ? #176
Comments
the article below does a pretty good job of explaining options for consuming ES Modules from within CommonJS. https://regbrain.com/article/how-to-run-es-packages-in-commonjs-modules TL;DR, you can:
|
Been using this for years. Disappointing change. Not seeing how this benefits things at all. I do not need to async load my date formatter. I'm gonna toss that in a const and ref it where I need to when I need to. Like at the start of the process. Once. Its already gonna be on disk. I'm not waiting for some http call to get it. Why would I go through these hoops just to 'use ES modules ooohh aaahhh' like some kind of epeen stroke... Moving on to some other date formatter that does not require annoying hoops to use. (I never go and comment like this- that's how stupid I think this change was.) |
@Kozenomenon thank you for taking the time to let us all know how you feel. |
I am now unable to import a module that uses dateformat from a Jest test, because Jest support for ES6 modules is still experimental and requires even more hoops to jump through. Thank you for providing this package, I would love to keep using it, but finding an alternative that keeps working with current versions of the tools we use is currently more acceptable than switching the whole project to an experimental mode of a critical UT framework we use. tl;dr While I applaud your effort to support ES6, which is the future, it's still too early to completely drop CommonJS support. |
@matushorvath Thanks so much for the feedback! If you have any suggestions for how we could improve, please feel free to raise a PR! 😄 |
@chase-manning I have opened #183 to add support for cjs |
I 100% agree this is a rather annoying change and doesn't seem to create any value. |
I encountered the same problem. How can this be fixed? |
using import I get this error
SyntaxError: Cannot use import statement outside a module
while using require this error
any hint ?
(node v16.13.0
npm 8.1.0)
The text was updated successfully, but these errors were encountered: