-
Notifications
You must be signed in to change notification settings - Fork 48
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
Exported as .default
in CJS build
#60
Comments
hello? anyone home? |
@thanpolas I published an alternative simple-invariant designed for use in NodeJS from CommonJS (although importing from ESM works fine too). |
I cannot reproduce this issue, see https://stackblitz.com/edit/node-znq7it: ❯ npm run test
$ node ./lib/test.js
console.log after successful invariant usage! Maybe some change since this issue was opened fixed the issue? |
Thanks for looking into this @pkerschbaum! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At present when requiring this library from CJS code (e.g. in Node),
require('tiny-invariant')
returns an object and you have to access the function from the.default
property.I know the purpose of this module is primarily for client-side code as then it can be effectively minimised in production builds. However, I like it so much, I now use it everywhere including pure Node.js code!
Would you consider reconfiguring the CJS builds so
require('tiny-invariant')
returns the actualinvariant
function?To avoid breaking changes, it'd be possible to also export invariant as property
.default
of itself e.g.:Or, to also issue a deprecation warning:
How do you feel about this?
I'd be happy to submit a PR.
The text was updated successfully, but these errors were encountered: