Re: bundling
Building a full-fledged frontend application is nowadays easier than ever, thanks to great frameworks like React or Angular, the mature state Javascript and Typescript have reached and the whole Node/NPM-ecosystem. One aspect of frontend development though that’s quite tedious yet results in massive performance gains (or losses, if done incorrectly or not at all) is the building step. It takes all your files as defined in a build-configuration and usally tries to minimize and transpile them to a older version of JS. If you’re using something like create-react-app, the whole setup for the buliding is hidden and already implemented. This also applies to the bundling during development, where you're files are processed before being available on your local dev server.
Snowpack?
The most two common tools for building & bundling these days are Webpack and Parcel. Each offer a wide variety of small and large gears to adjust so that the output created matches your preferences and requirements. As great as these tools are, they come with one caveat: the process can take quite long to start up and during development, when the bundler serves your files from localhost. Why? Because large chunks of your app have to be rebuild every time you make a change, even if the change itself was just small.
Snowpacks aims to fix this lag by serving your files unbundeld during development. Every file in your project can be interpreted as function, where the input is the file’s content and the output a cached version of it.
No bundling is the best bundling
B/c no bundling is done at all, the local dev server starts up immediately and only processes the files required at the given point in time. So even if your project grows very large, startup won’t be affacted much. If you want to setup Snowpack for yourself now, there’s a CLI-tool called “create-snowpack-app” to bootstrap your project for various targets such as a React-app.
And when you’re ready to deploy, Snowpack 2 still offers a build-command, which minifies and optimizes your codebase for production. The library is used by some well-known companies such as Intel or the Internet Archive, according to the site’s documentation. So if you have some spare minutes, it’s worth trying out!
- Tom