{"id":20814,"library":"webpack-remove-code-blocks","title":"webpack-remove-code-blocks","description":"A webpack loader plugin that removes blocks of code marked with special comment labels (e.g., `/* devblock:start */.../* devblock:end */`) from files processed by webpack. Current stable version 0.10.1 supports webpack >=3.0.0 and Node.js >=18. It allows multiple named block definitions, optional replacement text, and modes to skip removal based on webpack's `mode` option. Differentiates from alternatives by supporting custom labels, prefixes, and suffixes, and being actively maintained.","status":"active","version":"0.10.1","language":"javascript","source_language":"en","source_url":"https://github.com/kudashevs/webpack-remove-code-blocks","tags":["javascript","webpack","blocks","strip code","remove code","remove code blocks","webpack-loader","webpack-strip-blocks","webpack-remove-blocks"],"install":[{"cmd":"npm install webpack-remove-code-blocks","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-remove-code-blocks","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-remove-code-blocks","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: the plugin runs as a webpack loader; requires webpack >=3.0.0.","package":"webpack","optional":false}],"imports":[{"note":"The package exports a loader function directly, not a class or object. Use it as a string or object in webpack rules.","wrong":"Use via require('webpack-remove-code-blocks') as a constructor or class.","symbol":"default export (plugin instance) loader function","correct":"module.exports = { module: { rules: [ { test: /\\.js$/, use: 'webpack-remove-code-blocks' } ] } }"},{"note":"The loader name is a string; webpack resolves it from node_modules.","wrong":"loader: require.resolve('webpack-remove-code-blocks')","symbol":"loader path in webpack config","correct":"loader: 'webpack-remove-code-blocks'"},{"note":"Options are passed as an object under the `options` key in the rule's use array.","wrong":"Options passed as a separate argument or via plugin syntax.","symbol":"options object for custom blocks","correct":"options: { blocks: ['debug', { start: 'devblock_start', end: 'devblock_end', prefix: '/*', suffix: '*/' }] }"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        use: [\n          {\n            loader: 'webpack-remove-code-blocks',\n            options: {\n              blocks: ['devblock', 'debug']\n            }\n          }\n        ]\n      }\n    ]\n  }\n};\n\n// Input file: app.js\n/* devblock:start */\nconsole.log('remove me');\n/* devblock:end */\nconsole.log('keep me');\n\n// Output: 'keep me' block only","lang":"javascript","description":"Shows basic webpack configuration to remove code blocks labeled `devblock` from .js files, with input and expected output."},"warnings":[{"fix":"Upgrade to v0.10.1 or ensure Node.js >=18. Check block definitions as option format may have changed.","message":"Version 0.9.0 drops support for Node.js 16 and contains massive refactoring; may break older configs.","severity":"breaking","affected_versions":">=0.9.0 <0.10.0"},{"fix":"Review changelog for breaking changes; update block options if using custom start/end labels.","message":"Version 0.9.0 changes versioning and is described as a 'candidate for the initial release'; may introduce incompatibilities with earlier v0.1.x.","severity":"breaking","affected_versions":">=0.9.0 <0.10.0"},{"fix":"Use Node.js >=18 for v0.9.0+.","message":"Node.js 16 support dropped in v0.9.0.","severity":"deprecated","affected_versions":">=0.9.0"},{"fix":"Verify spelling in webpack config; use 'webpack-remove-code-blocks'.","message":"Loader name is 'webpack-remove-code-blocks' not 'webpack-remove-block' (similar package).","severity":"gotcha","affected_versions":"all"},{"fix":"Always specify at least one block label (e.g., `blocks: ['devblock']`).","message":"If no `blocks` option provided, default blocks may not be defined; the loader may process nothing.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev webpack-remove-code-blocks` and ensure the loader name is exactly 'webpack-remove-code-blocks'.","cause":"Loader name typo or missing npm install.","error":"Module not found: Error: Can't resolve 'webpack-remove-code-blocks'"},{"fix":"Use loader: 'webpack-remove-code-blocks' in the webpack rule, not as a plugin or function.","cause":"Using require() result as a constructor or plugin instead of a loader string.","error":"TypeError: loader is not a function"},{"fix":"Add `options: { blocks: ['devblock'] }` to the rule and use correct comment syntax: `/* devblock:start */ ... /* devblock:end */`.","cause":"Missing `blocks` options or wrong comment syntax.","error":"No blocks removed from output"},{"fix":"Check docs: mode value should be an array like `['development']` to skip removal in that mode.","cause":"Mode option expects array of webpack mode strings; may be misconfigured.","error":"Error: Mode removal not working"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}