{"id":22042,"library":"rollup-plugin-globlin","title":"rollup-plugin-globlin","description":"Rollup plugin (v0.1.4, latest stable) that provides file watching, copy, transform, repath, and rename capabilities using glob patterns. Differentiates from alternatives like rollup-plugin-copy by offering inline transformation via object or function, clean destination option, and no unnecessary dependencies. Ship TypeScript types. Low release cadence (initial release Aug 2024, no updates since). Primarily used for static asset copying with optional content modification in Rollup builds.","status":"active","version":"0.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/panoply/rollup-plugin-globlin","tags":["javascript","rollup-plugin","globs","file transforms","typescript"],"install":[{"cmd":"npm install rollup-plugin-globlin","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-globlin","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-globlin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; no CommonJS export. Use default import.","wrong":"const globs = require('rollup-plugin-globlin')","symbol":"default","correct":"import globs from 'rollup-plugin-globlin'"},{"note":"Type import only; not a runtime value.","wrong":"import { GlobsOptions } from 'rollup-plugin-globlin'","symbol":"type GlobsOptions","correct":"import type { GlobsOptions } from 'rollup-plugin-globlin'"},{"note":"Default import works in TS with esModuleInterop. Namespace import may cause runtime error.","wrong":"import * as globs from 'rollup-plugin-globlin'","symbol":"default (TypeScript)","correct":"import globs from 'rollup-plugin-globlin'"}],"quickstart":{"code":"import globs from 'rollup-plugin-globlin';\nimport { defineConfig } from 'rollup';\n\nexport default defineConfig({\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'cjs',\n  },\n  plugins: [\n    globs({\n      globs: ['assets/**/*.svg'],\n      dest: 'dist/assets',\n      clean: true,\n      transform: {\n        '**/*.svg': ({ content }) => ({\n          content: content.toString().toUpperCase(),\n          file: '[name].SVG',\n        }),\n      },\n    }),\n  ],\n});","lang":"typescript","description":"Copies SVG files from assets/ to dist/assets/, transforms content to uppercase, renames extension to .SVG, and cleans destination before copy."},"warnings":[{"fix":"Upgrade to v0.1.1 and adapt transform callback to accept an object with { content, file, dest } properties.","message":"v0.1.0 to v0.1.1: function signature for transform callback may change","severity":"breaking","affected_versions":"<0.1.1"},{"fix":"Always return { content, file, dest } from transform function or object; dest key in transform config object is ignored.","message":"transform object key 'dest' is deprecated in favor of returning object with 'dest' property","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Ensure content is a string, e.g., content.toString() if needed.","message":"transform function must return an object with 'content' as string or a string. Returning a Buffer causes runtime error.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Review transform documentation: string without slash = rename, string with slash = repath from dest.","message":"if transform returns a string without slash, it renames the file; with slash, it repaths relative to dest. Misunderstanding leads to unexpected output.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use clean: true with caution; avoid setting dest to root or important project directories.","message":"clean: true removes the dest directory before copying; if dest is a parent directory of project files, data loss may occur.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use import (ESM) instead: import globs from 'rollup-plugin-globlin'","cause":"Using CommonJS require to import an ESM-only package.","error":"TypeError: globs is not a function"},{"fix":"Ensure transform returns a string or an object with content property (string).","cause":"transform callback returns undefined or non-string/object.","error":"Error: transform must return a string or object"},{"fix":"Run: pnpm add rollup-plugin-globlin --save-dev","cause":"Package not installed or version does not exist.","error":"Error: Cannot find module 'rollup-plugin-globlin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}