-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Remove large dependencies #102
Comments
That would be great! Sorry, for bloating dependencies. |
Always a great reference site: https://bundlephobia.com/result?p=react-use@5.13.0 Could also be a good idea to update the build configuration for this package so that it additionally outputs an ES6 version (pointed at by the I do this in my library, for example here is the package output: Some build systems (e.g. create-react-app) will then automatically use the ES6 version and treeshake accordingly. |
@ctrlplusb bundlephobia is what prompted me to open this ticket, and is preventing us to use this because we don't want to bloat our bundle! Is there any progress on this? |
Ah damn I had never seen that comment! I'll start working on something when I have free time |
Opened PR: #161 |
I have been using {
"plugins": [
[
"import", {
"libraryName": "react-use",
"libraryDirectory": "lib",
"camel2DashComponentName": false
}
]
]
} |
|
@streamich I believe import { useAsync } from 'react-use'; Error:
|
This library minified is almost 52kb, which is huge for what it is. 60% of the bundle size is solely based on dependencies, all of which are only used in a few hook.
I would suggest making turning those into
peerDependencies
and requiring users to include the libraries in their ownpackage.json
. This would make the size of this library ~21kB.Although tree shaking should take care of this, not all environments support it, and forcing dependencies on users isn't the best course of action, especially if it's for a small functionality.
If this is a go, I could make the PR with the changes (code & docs) required for this.
The text was updated successfully, but these errors were encountered: