Parcel is my go-to asset bundler for small frontend projects consisting of mostly vanilla JS. It is generally zero-configuration and pretty smart about it - I can just install any npm package I want and use it in my code & Parcel will build nice minified JS assets for me. Much easier than Webpack… 😁
One interesting feature I came across: Tree Shaking, which means stripping out code from your dependencies that you do not import. Actually, I assumed Parcel was already doing this by default, but I noticed this when my bundle became >200KB although I was just using one dependency (date-fns), and just using a couple of methods from it.
Tree Shaking in Parcel is experimental, and can be activated by adding the command line argument
--experimental-scope-hoisting when running the
build command. For more info, see the CLI reference. Although the feature is experimental, it was working without an issue for my small use-case, and it successfully made my JS code shrink from over 200KB to just 10KB. Yeah! 🤩
Starting with Parcel v2, tree shaking is enabled by default. See https://v2.parceljs.org/getting-started/migration/#--experimental-scope-hoisting
- Linux (Debian/Ubuntu): Finding out whether a package is installed
- Windows: Adding programs to autostart
- Hosts file: What is it, why is it useful & how to edit it?
- Vagrant & VirtualBox shared folders: Getting symlinks to work on a Windows host
- SSH: Finding out ECDSA key fingerprint (both server-side & client-side)
- PowerPoint: Inserting Source Code with Syntax Highlighting
- Recommendation: Deep dive guide on web server fundamentals
- Where are globally-installed Go tools located & how to execute them (when using Go similarly to 'npm install -g')
- Compilation of modern CLI Tools (Unix, Shell, Terminal)
- (Linux) file system basics