tool posts

Rollup Strip plugin for dev code

I use JavaScript modules to organize my JS code. I use Rollup.js to package and minify these for distribution to reduce HTTP requests and transfer size, and to provide support for older browsers. So in development I’m using the modules directly and in production I’m using the built files. I was looking for a good way to have some extra code in for development purposes, but removing it for production. This could be used for a lot of things, including testing some code that runs on certain dates for dates other than the current one. I didn’t find a way to do this built in to Rollup, but there is an official plugin called Strip that allows removing specific labelled statements.

Continue reading post "Rollup Strip plugin for dev code"

</toby>