Wildcard imports are getting removed with tree shaking #997
-
Hi, I got another issue where tree shaking deletes code which is used. I created an example repository: https://github.com/papierschiff/snowpack-bug Steps to reproduce it:
The issue is the following import: But it is working when I import it like: see example import: https://github.com/papierschiff/snowpack-bug/blob/master/src/App.jsx |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You cannot use a namespace as a function. When you do Because "@react-hook/resize-observer" is a common.js package, it will be automatically exported as the default export. For these reasons, |
Beta Was this translation helpful? Give feedback.
You cannot use a namespace as a function. When you do
import * as useResizeObserver
,useResizeObserver
is guaranteed to be an object.Because "@react-hook/resize-observer" is a common.js package, it will be automatically exported as the default export.
For these reasons,
import useResizeObserver from '@react-hook/resize-observer';
is the only valid way to import this package.