Skip to content
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

Large bundled filesize #82

Open
sharkdp opened this issue Aug 7, 2016 · 5 comments
Open

Large bundled filesize #82

sharkdp opened this issue Aug 7, 2016 · 5 comments

Comments

@sharkdp
Copy link

sharkdp commented Aug 7, 2016

In the current version of purescript-react, react is required, so I need to use pulp browserify -O instead of pulp build -O. Compiling the purescript-react-example project, this leaves me with a 684K javascript file where most of the react stuff is still included. This feels quite heavy for a small demo project.

I am in the progress of updating a Thermite project to the newest version (of Thermite and -react) and this change increased the bundle filesize by a factor of 4-5. My guess is that the psc-bundle dead code eliminiation is somehow better than the browserify one.

Does someone have any ideas on how to address this problem?

@paf31
Copy link
Contributor

paf31 commented Aug 7, 2016

Another option is to write a little require shim in a JavaScript file. I think the purescript-react-example repo does that, and so does the Thermite demo.

@sharkdp
Copy link
Author

sharkdp commented Aug 7, 2016

Interesting. This doesn't help with dead code elimination (i.e. the total JS file size), though?

@paf31
Copy link
Contributor

paf31 commented Aug 7, 2016

Yes, you can use psc-bundle, and then you'll be left with the require statements for react and react-dom, which you can then provide using a shim.

@sharkdp
Copy link
Author

sharkdp commented Aug 7, 2016

Sorry for the poor explanation from my side. My point was that I (believe I) was previously able to use psc-bundle to perform DCE on react.js itself.

@paf31
Copy link
Contributor

paf31 commented Aug 10, 2016

Ah I see. I wasn't aware that was possible before, I'm slightly surprised 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants