Skip to content

Proposal: add option to build browserify / es6 modules #524

Open
@paralin

Description

@paralin

I'm interested in having Gopherjs produce rather than a single javascript file, multiple files - one for each Go package. This would provide huge benefits to those of us using a modern modular workflow for building apps, as tools like Webpack could better understand the relationships between the different pieces of code in the output JavaScript, and re-compile only the packages that change when bundling after a gopherjs build.

Currently in the output code, each Go package is set as a property on $packages. In a modular output, each Go package could go into its own file, and use module.exports to export what would have been set on $packages before. Then, code that previously would do something like $packages["github.com/gopherjs/js"] could instead do require("./github.com/gopherjs/js"). The output code tree could just match the names of the packages. A common package could be referenced for all of the common code that ends up at the beginning of the output file right now.

Is this something that would be feasible to implement in GopherJS?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions