Rollup plugin for processing assets (rebase, inline or copy) referenced from JavaScript/TypeScript code. Currently at version 2.1.2, with a stable release cadence. Key differentiators: supports three modes (rebase, inline, copy), keepImport for bundling libraries, custom hash algorithms (including MetroHash and xxHash), and full micromatch pattern support for include/exclude. Unlike rollup-plugin-url or @rollup/plugin-url, it prioritizes seamless config reuse with postcss-smart-asset and offers detailed hash options.
npm install rollup-plugin-smart-assetVerified import paths — ran on the pinned version, not inferred.
Copies assets (default .svg,.gif,.png,.jpg) into 'assets/' in output dir, references them with '/static/[hash][ext]'.
Use require('rollup-plugin-smart-asset').defaultSet extensions via include/exclude patterns instead
Set maxSize option explicitly to override
Replace import { smartAsset } with import smartAsset (or require with .default)Use const smartAsset = require('rollup-plugin-smart-asset').default