react-use
react-use copied to clipboard
react-use doesn't support webpack 5 tree shaking
What is the current behavior?
I installed react-use and only imported one hook:
import { useLocalStorage } from 'react-use';
But the build result bundled all hooks:

What is the expected behavior?
react-use should support webpack 5 tree shaking and only bundle useLocalStorage.js and depended modules.
A little about versions:
- OS:
- Browser (vendor and version):
- React:
-
react-use: - Did this worked in the previous package version?
Are you shure?

@guoyunhe By looking at the folder structure for the installed package it looks like we can import the individual functions directly like this:
import useLocalStorage from 'react-use/lib/useLocalStorage';
Although I am not sure if this is the right way to this