Automatically inject /* #__PURE__ */ annotations before specified function calls in Rollup, Vite, esbuild, and rspack builds to improve tree-shaking. Current stable version is 0.3.2 with infrequent releases. Supports all major bundlers via unplugin interface, includes TypeScript types, and allows flexible function matching via functions array and include/exclude patterns. Unlike manual annotations, this plugin automates the process for library authors.
npm install unplugin-pureNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Automatically annotate defineComponent and createApp calls as pure in files matching the include pattern using Vite plugin.
Use import { PluginPure } from 'unplugin-pure'Use RegExp, e.g., /\.(vue|jsx?)$/ or a string for exact paths.
Migrate to unplugin-pure as described in the README.
Wrap in a local const: const defineComp = module.defineComponent; then annotate defineComp.
Ensure rollup is installed when using Vite config.
Use `import { PluginPure } from 'unplugin-pure'`Run `npm install -D unplugin-pure` and ensure tsconfig.json includes 'moduleResolution': 'node' or 'bundler'.
Use named import: `import { PluginPure } from 'unplugin-pure'`Install the package and ensure bundler can resolve it.