fossamagna / gas-webpack-plugin

Webpack plugin for Google Apps Script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use this plugin + minify/urglify output code?

tangkhaiphuong-colpal opened this issue · comments

Hi, this plugin is great! But I need output code can uglify/minify?

@tangkhaiphuong-colpal
Output written as Code.gs in README.md is use case with none as webpack mode. It is example non minify. Please use webpack mode is production. You Should be able to got minified script.

webpack --mode production

I'm using Webpack 4, and if I don't set optimization.minimize to false then the function isn't prepended to the output.

@fossamagna Setting mode to production gives the same result. It's still not minified.

The problem seems to be in the file naming. If I set the output file to be file.gs, Webpack won't minify the file. On the other hand, if I set the output file to be file.js, Webpack will minify the file, but then gas-webpack-plugin doesn't work.

@tangkhaiphuong-colpal @alecmev @VladimirMikulic
Thank you for your report. I had can reproduce the issue.
I will try fix to this issue within several days.

@tangkhaiphuong-colpal @alecmev @VladimirMikulic
I published fixed version as v1.0.4. Please try to use new version.

@VladimirMikulic
If you would like to use gs as extension name , you need to configure options for terser-webpack-plugin.
See also: https://github.com/webpack-contrib/terser-webpack-plugin#test

@fossamagna I can confirm that this works! Thank you very much!