Minify unbundled files with Terser
See original GitHub issueRequirements
- For each theme that is processed, all deployed
.jsfiles that are not incore-bundle.jsshould be minified through terser - Minified files should be written in-place (same file name) to avoid the need for any path rewriting at build or runtime.
- Minification should happen in worker threads, to speed up compilation time and avoid blocking the main thread’s bundling work
Pieces
- For worker-based minification, there’s already the
createMinifiermodule that will create a pool of minification workers. We’ll want to add aminifyFromFileAPI, though, so we don’t need to read loose files into memory in the main process and then serialize/transfer/parse in the worker
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Use Terser to minify all JavaScript assets in Magento 2
Use Terser to minify all JavaScript assets in Magento 2 · Terser is the JavaScript minifier. · Now, let's bundle files with the...
Read more >An Introduction to the Rollup.js JavaScript Bundler - SitePoint
The fabulous Terser minifier can compact code by optimizing statements and removing whitespace, comments, and other unnecessary characters. The ...
Read more >A Future Without Webpack - Pika.dev
To be clear, leaving your application source unbundled isn't all sunshine and roses, either. Large JavaScript files do compress better over the wire...
Read more >Compressing JavaScript - Patterns.dev
Terser is a popular JavaScript compression tool for ES6+, and Webpack v4 includes a plugin for this library by default to create minified...
Read more >vite build - patak-dev
If build.minify is 'terser' (currently the default), this plugin is used to minify each rendered chunk using terser . Vite may ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This is what a bash script that does this looks like:
@GuiltyNL thanks that improved my deploy by 30 minutes 😃
@DrewML missed that thanks love baler so far.