{"id":20527,"library":"rollup-plugin-prettier","title":"rollup-plugin-prettier","description":"Rollup plugin to format the final bundle with Prettier. Current stable version is 4.1.2, supports Prettier ^1.0.0 || ^2.0.0 || ^3.0.0 and Rollup ^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0. Ships TypeScript types. Key differentiators: integrates Prettier as a Rollup plugin, handles source map generation by computing diffs. Release cadence is irregular, with recent updates focused on dependency upgrades and Rollup/Prettier version support.","status":"active","version":"4.1.2","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/mjeanroy/rollup-plugin-prettier","tags":["javascript","rollup","rollup-plugin","prettier","typescript"],"install":[{"cmd":"npm install rollup-plugin-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: the actual formatter","package":"prettier","optional":false},{"reason":"Peer dependency: Rollup bundler","package":"rollup","optional":false}],"imports":[{"note":"Plugin is a default export, not named.","wrong":"import { prettier } from 'rollup-plugin-prettier'","symbol":"default","correct":"import prettier from 'rollup-plugin-prettier'"},{"note":"CJS default import via require.","wrong":"const { prettier } = require('rollup-plugin-prettier')","symbol":"default","correct":"const prettier = require('rollup-plugin-prettier')"},{"note":"TypeScript types are included, but typically not needed as options are inferred.","wrong":null,"symbol":"types","correct":"import type { PrettierOptions } from 'rollup-plugin-prettier'"}],"quickstart":{"code":"import prettier from 'rollup-plugin-prettier';\nimport { defineConfig } from 'rollup';\n\nexport default defineConfig({\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'es',\n  },\n  plugins: [\n    prettier({\n      tabWidth: 2,\n      singleQuote: true,\n      parser: 'babel',\n    }),\n  ],\n});","lang":"typescript","description":"Configures Rollup to format output bundle with Prettier using tab width 2 and single quotes."},"warnings":[{"fix":"Install prettier as a devDependency: npm install --save-dev prettier","message":"In v1.0.0, prettier dependency changed from direct to peer dependency.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Upgrade plugin to v4.0.0 or later to use prettier v3","message":"In v4.0.0, support for prettier ^3.0.0 added; older versions may still work but are not tested.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Use sourcemap: true instead of sourceMap: true","message":"The sourceMap option (camelCase) was deprecated in v1.0.0 in favor of sourcemap (all lowercase).","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Disable source map in plugin options if not needed, or accept slower builds.","message":"Source map generation may be slow for large bundles because the plugin computes diffs to generate a source map.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"No action needed; asynchronous mode prepares for Prettier v3 async API.","message":"The plugin runs Prettier synchronously (before v3.1.0) or asynchronously (v3.1.0+), but this is transparent to the user.","severity":"gotcha","affected_versions":">=3.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import prettier from 'rollup-plugin-prettier' (default import) instead of import { prettier } from 'rollup-plugin-prettier'.","cause":"Importing named export instead of default export.","error":"TypeError: prettier is not a function"},{"fix":"Run npm install --save-dev prettier to install it.","cause":"Prettier is a peer dependency not installed.","error":"Error: Cannot find module 'prettier'"},{"fix":"Run npm install --save-dev rollup-plugin-prettier","cause":"Plugin not installed.","error":"Error: RollupError: Could not resolve 'rollup-plugin-prettier'"},{"fix":"Change sourceMap: true to sourcemap: true in plugin options.","cause":"Using deprecated camelCase option.","error":"Error: The 'sourceMap' option is deprecated. Use 'sourcemap' instead."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}