Optimize Webpack Bundles with workerize-loader and Microbundle for Small Modules
Summary of my bookmarked Github repositories from Aug 13th, 2019
The workerize-loader is a valuable tool for Webpack users. It enables the movement of a module into a Web Worker, automatically transforming exported functions into asynchronous proxies. This efficient bundling feature includes a small, purpose-built RPC implementation, supports synchronous and asynchronous worker functions, and seamlessly integrates with async/await syntax. The package is lightweight, weighing only 800 bytes when gzipped. To utilize workerize-loader, simply install it via npm and pass a function or code string as an argument. It's an excellent solution for optimizing your app's performance.
Microbundle is a zero-configuration bundler powered by Rollup, designed for small modules. It offers features such as ESnext and async/await support, optimized code generation, multiple entry modules and output formats (CJS, UMD, and ESM), TypeScript support, Terser compression, and gzipped bundle size tracking. Installation and setup involve running "npm i -D microbundle" and configuring the package.json file. Microbundle produces bundles in esm, cjs, and umd formats, and additionally provides a modern bundle that works in most modern browsers without transpilation.