{"id":26325,"library":"rollup-plugin-content","title":"rollup-plugin-content","description":"Rollup/Vite plugin for generating i18n static content and summaries from YAML or JSON files. Version 0.8.0, maintained regularly. Enables SPA blogs with i18n support by converting directory structures into importable summary and page modules. Differentiates from static site generators by integrating directly into the build pipeline, providing summary indexes by category and keywords.","status":"active","version":"0.8.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","rollup-plugin","vite-plugin","rollup","typescript"],"install":[{"cmd":"npm install rollup-plugin-content","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-content","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-content","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides utility functions for Rollup plugins (filtering, creating modules)","package":"@rollup/pluginutils","optional":false},{"reason":"Peer dependency; plugin only works with Rollup","package":"rollup","optional":false},{"reason":"Peer dependency; also compatible with Vite","package":"vite","optional":true}],"imports":[{"note":"ESM-only; requires Rollup or Vite to resolve. Named export, not default.","wrong":"const content = require('rollup-plugin-content')","symbol":"content","correct":"import { content } from 'rollup-plugin-content'"},{"note":"Default export is the same as named export 'content' since v0.4.0.","wrong":"import { content } from 'rollup-plugin-content'","symbol":"default","correct":"import content from 'rollup-plugin-content'"},{"note":"Sub-plugin for generating summaries; must be used inside content() plugins array.","wrong":"","symbol":"summary","correct":"import { summary } from 'rollup-plugin-content'"}],"quickstart":{"code":"import yaml from 'js-yaml';\nimport { content } from 'rollup-plugin-content';\n\nexport default {\n  input: 'src/app.js',\n  output: { format: 'es', dir: 'dist', sourcemap: true },\n  plugins: [\n    content({\n      langs: ['en', 'uk'],\n      parse: yaml.load,\n      plugins: [\n        summary({ fields: ['title', 'createdAt'] })\n      ]\n    })\n  ]\n};","lang":"javascript","description":"Rollup configuration to generate i18n content and summaries from YAML files with languages 'en' and 'uk'."},"warnings":[{"fix":"Replace `import content from 'rollup-plugin-content'` with `import { content } from 'rollup-plugin-content'` or upgrade to >=0.4.0.","message":"Default export changed from `content` to `{ content as default }` in v0.4.0. Importing without braces may break.","severity":"breaking","affected_versions":"<0.4.0"},{"fix":"Replace `matches` with `include` and `exclude` options (e.g., { include: ['**/*.yml'] })","message":"The `matches` option is deprecated; use Rollup's `include`/`exclude` patterns via @rollup/pluginutils.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Use format like `about.en.yml`, not `about_en.yml` or `en.about.yml`.","message":"Files must follow naming convention: `<name>.<lang>.yml` or `<name>.<lang>.json`. Incorrect naming may result in files not being processed.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add an import statement in your entry file referencing the generated summary module.","message":"Summary imports are generated as side-effect modules; you must import them (e.g., `import '../content/pages.summary'`) even if not used in application code.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install -D rollup-plugin-content` and use correct import: `import { content } from 'rollup-plugin-content'`.","cause":"Package not installed or import path incorrect (e.g., missing 'rollup-plugin-content' in package.json)","error":"Error: Could not resolve 'rollup-plugin-content'"},{"fix":"Use `import { content } from 'rollup-plugin-content'`.","cause":"Using default import without braces; package exports a named export 'content' as the plugin.","error":"TypeError: content is not a function"},{"fix":"Install `js-yaml` and pass `parse: yaml.load` to `content()` options.","cause":"Rollup/Vite cannot parse YAML files without a parse function provided to the content plugin.","error":"Module parse failed: Unexpected token (1:0) - You may need an appropriate loader to handle this file type."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}