Rollup Strip Block
Rollup plugin to strip blocks of code marked by special comment tags. Useful for removing code that you don't want in your production bundle (e.g. verbose console warnings, etc).
Install:
$ npm install --save-dev rollup-plugin-strip-blocks
or
$ yarn add -D rollup-plugin-strip-blocks
Example:
In your client js source files:
var { // The following code will be stripped with our plugin /* develblock:start */ if bar instanceof Bar !== true throw 'makeFoo: bar param is required and must be instance of Bar'; /* develblock:end */ // This code would remain return bar baz;}
In your rollup config, specify the plugin:
// rollup.config.js entry: 'src/main.js' dest: 'dist/app.js' format: 'iife' plugins:
If you want to use custom comment tags to mark the start and end of the block to strip from your code, you can add options for "start" and "end" like this:
// rollup.config.js entry: 'src/main.js' dest: 'dist/app.js' format: 'iife' plugins: