Replies: 2 comments
-
It is a common issue with directives. The imported directive is tree-shaken. To prevent it, you need use the function in the imported module: true && directiveFn You can check for a detailed answer: https://stackoverflow.com/a/77049172/7134134 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ironically its TypeScript not the bundler that is responsible. The bundler gets the code last so it can see it is used. TS on the otherhand gets it first and does its own treeshaking because it needs to remove type only imports. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Unless I reference
onClickTheme
in the code outside of the JSX, it appears that the reference is removed.broken:
error:
Uncaught ReferenceError: onClickTheme is not defined
working:
original:
stack:
Beta Was this translation helpful? Give feedback.
All reactions