{"id":22191,"library":"rollup-plugin-raw","title":"rollup-plugin-raw","description":"Rollup plugin that transforms raw text files (e.g., .txt, .glsl, .fs) into ES modules that export the file content as a string. Current stable version is 0.0.1, requiring Node.js v14+ and Rollup v3+. Lightweight and minimal, with TypeScript type definitions included. Differentiators: simple regex-based filtering, no dependencies.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/simo-an/bundle-plugins","tags":["javascript","rollup","raw file","rollup plugin","rollup plugin raw file","typescript"],"install":[{"cmd":"npm install rollup-plugin-raw","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-raw","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-raw","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export; named import incorrect.","wrong":"import { raw } from 'rollup-plugin-raw'","symbol":"raw","correct":"import raw from 'rollup-plugin-raw'"},{"note":"CommonJS require works for default export.","wrong":"const { raw } = require('rollup-plugin-raw')","symbol":"raw","correct":"const raw = require('rollup-plugin-raw')"},{"note":"Use package name, not direct file path.","wrong":"import raw from 'rollup-plugin-raw/index.js'","symbol":"raw","correct":"import raw from 'rollup-plugin-raw'"}],"quickstart":{"code":"// rollup.config.js\nimport { defineConfig } from 'rollup';\nimport raw from 'rollup-plugin-raw';\n\nexport default defineConfig({\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'es'\n  },\n  plugins: [\n    raw({\n      filter: /\\.(txt|glsl|fs)$/i\n    })\n  ]\n});\n\n// src/test.txt\nhello world\n\n// src/index.js\nimport txt from './test.txt';\nconsole.log(txt); // 'hello world'","lang":"javascript","description":"Configures Rollup to import raw text files as strings using rollup-plugin-raw."},"warnings":[{"fix":"Upgrade Rollup to >=3.0.0 and Node to >=14.0.0.","message":"Plugin requires Rollup v3.0.0+ and Node v14.0.0+. Using older versions will cause errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin exact version and test upgrades.","message":"The plugin is extremely early (v0.0.1); API may change without major semver bump.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pnpm add rollup-plugin-raw -D' or 'npm install --save-dev rollup-plugin-raw'.","cause":"Plugin not installed or missing from node_modules.","error":"Error: Cannot find module 'rollup-plugin-raw'"},{"fix":"Use 'import raw from 'rollup-plugin-raw'' (default import).","cause":"Using named import instead of default import.","error":"TypeError: raw is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}