strip-whitespace-plugin
Strip-Whitespace-Plugin is a plugin for webpack that will remove extraneous spaces from strings. It's perfect for working with rendering templates (ex. mustache, handlebars) or es6 javascript templates. It works with anything where you might create very long strings.
This plugin and the Strip-Whitespace-Loader do the same thing. The loader can be applied to specific modules/files/assets. This plugin will strip whitespace on all assets.
Before strip-whitespace:
{if conditionconst longString = ' String with some extra spaces ';}
After strip-whitespace:
{if conditionconst longString = ' String with some extra spaces ';}
Webpack usage
Put this plugin before your minification plugins (ex. uglify-js)
var StripWhitespace = ;moduleexports =...plugins:...// put your minification plugins here....;