Rollup plugin that copies imported files (e.g., SVG, SCSS) to the output directory while marking them as external in the bundle. Version 1.0.0 rewrites in TypeScript with type declarations. Best used with rollup's preserveModules option to keep imports tree-shakable. Unlike generic copy plugins, it integrates with rollup's watch mode and handles asset re-imports. Requires rollup ^1.20.0 || ^2.0.0 || ^3.0.0.
npm install rollup-plugin-static-importVerified import paths — ran on the pinned version, not inferred.
Configures rollup to copy SVG and SCSS files from src to dist, marking them as external so the consuming app bundles them.
Set preserveModules: true in rollup config.
Always provide include with at least one glob pattern.
Use dynamic import() or configure your bundler to handle ESM. If using CommonJS, stay on v0.x.
Set baseDir to the directory relative to which you want files copied. Default is 'src'.
Use import syntax in your config file (if rollup supports it) or switch to dynamic import: const staticImport = (await import('rollup-plugin-static-import')).default;Use default import: import staticImport from 'rollup-plugin-static-import'
Verify that include patterns match files relative to projectRoot (default cwd) or adjust projectRoot option.