{"id":22224,"library":"rollup-plugin-smart-asset","title":"rollup-plugin-smart-asset","description":"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.","status":"active","version":"2.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/sormy/rollup-plugin-smart-asset","tags":["javascript","rollup-plugin","asset","rebase","url","copy","inline"],"install":[{"cmd":"npm install rollup-plugin-smart-asset","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-smart-asset","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-smart-asset","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required; plugin only works with Rollup bundler","package":"rollup","optional":false}],"imports":[{"note":"Default export only; named import will result in undefined.","wrong":"import { smartAsset } from 'rollup-plugin-smart-asset'","symbol":"smartAsset","correct":"import smartAsset from 'rollup-plugin-smart-asset'"},{"note":"CJS users must access .default due to ESM->CJS interop.","wrong":"const smartAsset = require('rollup-plugin-smart-asset')","symbol":"smartAsset (CommonJS)","correct":"const smartAsset = require('rollup-plugin-smart-asset').default"}],"quickstart":{"code":"import smartAsset from 'rollup-plugin-smart-asset';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm'\n  },\n  plugins: [\n    smartAsset({\n      url: 'copy',\n      assetsPath: 'assets',\n      publicPath: '/static/',\n      useHash: true,\n      keepName: false,\n      maxSize: 14\n    })\n  ]\n};","lang":"javascript","description":"Copies assets (default .svg,.gif,.png,.jpg) into 'assets/' in output dir, references them with '/static/[hash][ext]'."},"warnings":[{"fix":"Use require('rollup-plugin-smart-asset').default","message":"Default export is not a function in CJS require() – must use .default","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set extensions via include/exclude patterns instead","message":"If using 'include' or 'exclude', the 'extensions' option is ignored","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set maxSize option explicitly to override","message":"Maximum file size for inline mode default is 14 kB (not 10 or 20)","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.1.2':22 'algorithm':42 'asset':5,10,70,80 'bundl':38 'cadenc':27 'code':18 'config':64 'copi':14,35,83 'current':19 'custom':40 'detail':73 'differenti':29 'full':48 'hash':41,74 'includ':43 'include/exclude':53 'inlin':12,34,84 'javascript':76 'javascript/typescript':17 'keepimport':36 'key':28 'librari':39 'metrohash':44 'micromatch':49 'mode':32 'offer':72 'option':75 'pattern':50 'plugin':3,7,57,79 'postcss':68 'postcss-smart-asset':67 'priorit':62 'process':9 'rebas':11,33,81 'referenc':15 'releas':26 'reus':65 'rollup':2,6,56,78 'rollup-plugin':77 'rollup-plugin-smart-asset':1 'rollup-plugin-url':55 'rollup/plugin-url':60 'seamless':63 'smart':4,69 'stabl':25 'support':30,51 'three':31 'unlik':54 'url':58,82 'version':21 'xxhash':46","created_at":"2026-04-27T17:04:01.977720+00:00","updated_at":"2026-04-27T17:04:01.977720+00:00","problems":[{"fix":"Replace import { smartAsset } with import smartAsset (or require with .default)","cause":"Using named import instead of default import","error":"Error: The 'rollup-plugin-smart-asset' plugin is not a function"},{"fix":"Use const smartAsset = require('rollup-plugin-smart-asset').default","cause":"CJS require returns an object with .default property","error":"TypeError: smartAsset is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/sormy/rollup-plugin-smart-asset","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-smart-asset","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}