Skip to content

Package splitting #2

@dave

Description

@dave

The jsgo compiler uses GopherJS to compile Go to Javascript. It splits the output by Go package, meaning each package is individually cached by the browser. This has benefits:

  • Several projects that use the fmt package will share the same fmt.js script.
  • Deploying a small change to a project will result in clients only re-downloading the javascript for packages with changes.

Unfortunately the Go compiler doesn't support the same package splitting, so this isn't possible in the WASM version.

This ticket is to track any possible work-arounds.

Two possibilities have been researched:

  1. Fork the Go compiler and modify it to emit the WASM binary for each package separately.
  2. Split the WASM binary after it's been created by the Go compiler.

I worked on forking the Go compiler for a couple of weeks, but as expected there were huge issues. I'm not planning to continue work on this. See here for progress.

@dennwc worked on the WASM binary splitter, but came across problems. However, this is the preferred option for anyone who wants to help. See here for progress.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions