Skip to content

Wildcard imports are getting removed with tree shaking #997

Answered by FredKSchott
msaehn asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@msaehn
Comment options

@FredKSchott
Comment options

Answer selected by msaehn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants