O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Taming the GopherJS-produced JavaScript file size

During the production deployment process, we must issue the gopherjs build command, specifying the option to minify the produced JavaScript source file and to save the output of the JavaScript source file to a specified target location.

We must minify the produced JavaScript code to reduce its file size. As mentioned previously, the un-minified, JavaScript source file is 8.1 MB! We can further reduce the size of the source file to 2.9 MB by minifying it, running the gopherjs build command with the -m option and by specifying the --tags option with the value clientonly like so:

$ gopherjs build -m --verbose --tags clientonly -o $IGWEB_APP_ROOT/static/js/client.min.js

The clientonly tag, tells ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required