-
Notifications
You must be signed in to change notification settings - Fork 95
Add esm support #86
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
Add esm support #86
Conversation
I would also recommend using |
FYI exports.default = hoistNonReactStatics increases bundled commonjs version to 4204 |
Those have to be raw measurements right? I always compare gzipped - seems more relevant |
Yeah, I'm trying to take more attention on parsing size. Do you think it's a good idea to enable |
Nowadays - yes, consistency is imho more important than "cuteness". One can always assign |
This is why I prefer named exports. // here we need to always provide alias for "default"; for commonjs we don't have nice syntax
const { default: hoistNonReactStatics } = require('hoist-non-react-statics');
import { default as hoistNonReactStatics } from 'hoist-non-react-statics';
// vs; much easier to provide name out of the box
const { hoistNonReactStatics } = require('hoist-non-react-statics');
import { hoistNonReactStatics } from 'hoist-non-react-statics'; |
Here's the difference between bundled with webpack `console.log(hoistNonReactStatics)` hoist-non-react-statics.cjs.js: 4155 hoist-non-react-statics.esm.js: 4107 React-apollo is solved the problem with rollup interop. https://unpkg.com/[email protected]/react-apollo.cjs.js Though to prevent similar headaches with projects written in commonjs I recommend to bump major release.
1 similar comment
Would it make more sense to introduce a breaking change to switch to named exports entirely? Although I guess doing it this way means only CJS users need to update their |
The last major release caused so many issues that I'd rather avoid this. HOCs are still used and as soon as react would introduce new statics then any hoc using an older version of |
Here's the difference between bundled with webpack
console.log(hoistNonReactStatics)
hoist-non-react-statics.cjs.js: 4155
hoist-non-react-statics.esm.js: 4107
React-apollo is solved the problem with rollup interop.
https://unpkg.com/[email protected]/react-apollo.cjs.js
Though to prevent similar headaches with projects written in commonjs
I recommend to bump major release.
/cc @Andarist @eps1lon