Open sharkdp opened 8 years ago
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.
Interesting. This doesn't help with dead code elimination (i.e. the total JS file size), though?
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.
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.
Ah I see. I wasn't aware that was possible before, I'm slightly surprised 😄
In the current version of purescript-react, react is
require
d, so I need to usepulp browserify -O
instead ofpulp build -O
. Compiling the purescript-react-example project, this leaves me with a 684K javascript file where most of thereact
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 (ofThermite
and-react
) and this change increased the bundle filesize by a factor of 4-5. My guess is that thepsc-bundle
dead code eliminiation is somehow better than thebrowserify
one.Does someone have any ideas on how to address this problem?