A Rollup/Vite plugin that removes comments, console.* calls, and debugger statements from bundles after tree-shaking. Current stable version is 2.0.1, requiring Rollup >=4.0.0 or Vite >=5.0.0. It offers presets for application and library bundling with sensible defaults: the default preset removes all comments and console calls; the application preset preserves licensing comments and console.log/info/warn/error; the library preset preserves licensing and JSDoc comments. Fully configurable via options object, allowing fine-grained control over which comments and console methods to remove.
npm install rollup-plugin-code-rakerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Example Rollup config using code-raker with application preset, removing only debug/trace console calls and preserving licenses but removing docs.
Upgrade Rollup to >=4.0.0 or Vite to >=5.0.0.
Avoid removing annotations unless you understand the impact on tree-shaking.
Use preset: 'application' or 'library' instead of relying on defaults.
If you need to preserve line comments, consider using a different plugin or preprocessing.
Update to v2 and adjust options to the new interface (preset, comments, console).
Run 'npm install --save-dev rollup-plugin-code-raker'.
Use 'import codeRaker from 'rollup-plugin-code-raker''.
Upgrade Rollup to >=4.0.0 or use an older version of the plugin (<=1.x).
Use 'const codeRaker = require('rollup-plugin-code-raker').default'.