hoist-non-react-statics
hoist-non-react-statics copied to clipboard
strange behavior when multiple v2 versions are in the same bundle
See https://github.com/styled-components/styled-components/issues/1972
We use the library in styled-components like this https://github.com/styled-components/styled-components/blob/9d72abe32754ae9dd0bf9edf8a652ea592bdd06a/src/models/StyledComponent.js#L351-L362
Not really sure what to make of this 😕
After more digging, the issue manifested with both 2.5.0 and 2.5.5 in the same bundle. This was due to next.js pinning their version to 2.5.0.
It's not clear to me why there were strange behaviors though, the library should be side effect free?
Interesting. I'm looking through the version history to see if there were any bugs in 2.5.x that may have been fixed by 2.5.5. As far as I see, I think those versions only involved TypeScript definition changes.
I think I'm having the same issue:
ModuleNotFoundError: /node_modules/formik/dist/formik.cjs.development.js
Module not found: Error: Can't resolve 'hoist-non-react-statics' in '/formik/dist'
ModuleNotFoundError: /node_modules/react-intl/lib/index.js
Module not found: Error: Can't resolve 'hoist-non-react-statics' in '/react-intl/lib'
It seems that both react-intl
and formik
depend on the same version and for some reason that results in the library not being installed on my machine 🤔
Formik: "hoist-non-react-statics": "^2.5.5",
React-Intl: "hoist-non-react-statics": "^2.5.5",