-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Tree shaking is not working with React output target #255
Comments
This issue is similar to #222 |
@arvindanta thanks for opening this issue and confirming that splitting the generated components into separate files resolves the issue. I'll capture as a bug and prioritize 👍 |
Is this still being prioritized? I still can't get my React output to tree shake. I'd love to adopt this library and port over my components, but this is a major blocker. Is there anything that I can do to help? |
@R-Bower can you try this out -https://github.com/arvindanta/stencil-react-wrapper I forked the react-output-target and added changes to enable tree shakability. We are using this in
|
I'll give it a shot, thanks! |
The components don't render in my docusaurus application, although it works in NextJS. |
Is there an official fix for this available via the |
any update on this, it is unable to get build what i used in my app |
@arvindanta hey, i was tried your lib in react with vite bundler which still gives me large bundle with registering all components and i have also tested in angular where you used defineCustomElements() which define all elements and it's end up build all entries even i used button component |
Is there any movement on this? I see a PR was opened last year but it has not been completed. |
Hi guys any update on |
Prerequisites
Stencil Version
2.9
Stencil Framework Output Target
React
Stencil Framework Output Target Version
0.3.1
Current Behavior
Hi, I am using react output target to generate a tree shakable bundle of the React components. Stencil config file below.
Usage in the consuming app,
import { FwButton } from "@freshworks/crayons/react";
when I run npm run build, in the main script that gets bundled, I see code for all the components added and tree shaking is not working.
Expected Behavior
Tree shaking should work fine.
Steps to Reproduce
Stencil config file below.
Usage in the consuming CRA app,
import { FwButton } from "@freshworks/crayons/react";
when I run npm run build, in the main script that gets bundled, I see code for all the components added and tree shaking is not working.
Code Reproduction URL
https://github.com/freshworks/crayons/
Additional Information
The issue is because all the components are imported and exported from the same file.
Fix - https://github.com/arvindanta/stencil-react-wrapper/blob/master/src/output-react.ts#L155
I had solved this by forking this repo and exported each component in a separate file and they are just imported here. Can we please check on this ?
component.ts
FwAccordion file
No response
The text was updated successfully, but these errors were encountered: