Skip to content

Large bundled filesize #82

Open
Open
@sharkdp

Description

@sharkdp

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?

Activity

paf31

paf31 commented on Aug 7, 2016

@paf31
Contributor

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

sharkdp commented on Aug 7, 2016

@sharkdp
Author

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

paf31

paf31 commented on Aug 7, 2016

@paf31
Contributor

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

sharkdp commented on Aug 7, 2016

@sharkdp
Author

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

paf31 commented on Aug 10, 2016

@paf31
Contributor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @paf31@sharkdp

        Issue actions

          Large bundled filesize · Issue #82 · purescript-contrib/purescript-react