Registry / devops / rollup-plugin-strip-blocks

rollup-plugin-strip-blocks

JSON →
library1.0.3jsnpmunverified

Rollup plugin that removes blocks of code delimited by special comment tags (/* develblock:start */ and /* develblock:end */ by default) from bundled output. Useful for stripping development-only code such as verbose console warnings, assertions, or debug logs from production builds. Current version 1.0.3 has no updates since release; low maintenance cadence. Differentiators: simple comment-based approach vs AST-based plugins like rollup-plugin-strip-code; no configuration required for basic use.

npm install rollup-plugin-strip-blocks
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-STRI
R
rollup-plugin-strip-blocks
devopsjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stripblocks
import stripblocks from 'rollup-plugin-strip-blocks'
const stripblocks = require('rollup-plugin-strip-blocks')
ESM-only package; requires import syntax, not CommonJS require.
start
stripblocks({ start: 'DEV-START', end: 'DEV-END' })
Options are passed as an object with start and end strings for custom comment tags.
end
stripblocks({ end: 'DEV-END' })
stripblocks({ end: 'DEV-END' }) without start
Both start and end must be specified together; if only one is provided, the plugin uses the default for the other.

Basic rollup config using the strip-blocks plugin to remove development blocks from the output bundle.

// rollup.config.js import stripblocks from 'rollup-plugin-strip-blocks'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'es', }, plugins: [ stripblocks() ] };
Debug
Known issues
gotchaPlugin does not remove the comment tags themselves; only the code between them is stripped. If you want the comments removed, use an additional plugin like rollup-plugin-terser.
fix
Add a minifier or code removal plugin after strip-blocks.
affects: all
gotchaThe plugin only works with /* */ multi-line comments as delimiters, not // single-line comments.
fix
Ensure your delimiters are block comments: /* develblock:start */ and /* develblock:end */.
affects: all
deprecatedThe plugin uses Rollup's deprecated transform hook internally; may break in future Rollup versions.
fix
Consider using rollup-plugin-strip-code as a more modern alternative.
affects: >=1.0.0
gotchaDefault comment tags are case-sensitive: /* develblock:start */, not /* DevelBlock:start */.
fix
Use exactly the default tags or override with custom tags via options.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-strip-blocks'
Package not installed or not resolved as a devDependency.
fix
Run: npm install --save-dev rollup-plugin-strip-blocks
TypeError: stripblocks is not a function
Incorrect import style; using require() instead of import.
fix
Use: import stripblocks from 'rollup-plugin-strip-blocks'
The plugin is not stripping my code blocks
Comment tags are not matched (e.g., missing / before *, or wrong case).
fix
Ensure blocks are wrapped with /* develblock:start */ and /* develblock:end */ (default). Check for typos.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
rolluprequiredpeer dependency required for plugin functionality
Agent activity
6 hits · last 30 days
node
6
Resources
rollup-plugin-strip-blocks — npm install rollup-plugin-strip-blocks · libregistry