Rollup plugin to remove assert, invariant, and similar statements from production bundles. Current stable version: 1.3.2 (2024-08-23). Release cadence: active development with frequent updates. Key differentiator: supports both ESM and CJS, ships TypeScript definitions, and handles conditional expressions. Unlike alternatives, it integrates naturally with Rollup's plugin system and respects source maps. Peer dependencies: acorn ^8.12.1 and rollup ^4.20.0.
npm install rollup-plugin-deassertVerified import paths — ran on the pinned version, not inferred.
Example of using rollup-plugin-deassert in a Rollup config to strip assert statements from TypeScript files.
Replace default import { deassert } from 'rollup-plugin-deassert' with named import { rollupPlugin as deassert } from 'rollup-plugin-deassert'.Upgrade to >=1.3.0 to handle conditional expressions.
Add include: ['**/*.ts'] or appropriate glob to deassert() options.
Consider migrating to the 'deassert' package for cross-bundler compatibility.
Run 'npm install -D rollup-plugin-deassert' or check package.json for correct name.
Use 'import { rollupPlugin as deassert } from 'rollup-plugin-deassert'' instead of 'import deassert from ...'.Ensure the import is correct and the plugin is included in the plugins array: plugins: [deassert()].
Add 'include: ["**/*.ts"]' to deassert options if using TypeScript files.