{"id":22211,"library":"rollup-plugin-sass","title":"rollup-plugin-sass","description":"Rollup plugin for compiling Sass/SCSS files into CSS, with support for output to file, insertion into <head>, and custom processors (e.g., PostCSS). Current version 1.15.3, released July 2024, with maintenance releases focused on dependency updates and vulnerability fixes. Key differentiators: supports both legacy `node-sass` and modern `sass` compiler via `api` option (added in v1.15.0), CSS modules via processor, and TypeScript types included. Release cadence is irregular but with periodic maintenance updates.","status":"active","version":"1.15.3","language":"javascript","source_language":"en","source_url":"https://github.com/elycruz/rollup-plugin-sass","tags":["javascript","rollup","rollup-plugin","sass","typescript"],"install":[{"cmd":"npm install rollup-plugin-sass","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-sass","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-sass","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for compiling Sass files; the plugin uses the `sass` package under the hood.","package":"sass","optional":false}],"imports":[{"note":"ESM default export; CommonJS require returns the default directly, not as .default. TypeScript requires `esModuleInterop` or `allowSyntheticDefaultImports`.","wrong":"const sass = require('rollup-plugin-sass').default;","symbol":"default (plugin)","correct":"import sass from 'rollup-plugin-sass';"},{"note":"TypeScript users should use type import for options.","wrong":"","symbol":"SassOptions","correct":"import type { SassOptions } from 'rollup-plugin-sass';"},{"note":"TypeScript users should use type import for plugin options.","wrong":"","symbol":"SassPluginOptions","correct":"import type { SassPluginOptions } from 'rollup-plugin-sass';"}],"quickstart":{"code":"// rollup.config.js\nimport sass from 'rollup-plugin-sass';\nimport autoprefixer from 'autoprefixer';\nimport postcss from 'postcss';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'cjs',\n  },\n  plugins: [\n    sass({\n      output: 'dist/bundle.css',\n      processor: (css) =>\n        postcss([autoprefixer])\n          .process(css, { from: undefined })\n          .then((result) => result.css),\n    }),\n  ],\n};","lang":"javascript","description":"Basic Rollup config that compiles SCSS to CSS, writes to file, and runs PostCSS with autoprefixer."},"warnings":[{"fix":"Use either `output` or `insert`, not both.","message":"The `insert` option requires the sass compiler to output a utility function that inserts styles into <head>. Ensure you are not using `output: true` together with `insert: true` (they conflict).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure processor functions are compatible with both legacy and modern API returns.","message":"When `api: 'modern'` is set (v1.15.0+), the `sass` package's modern API is used. This changes return types and may break custom processors that expect the legacy API.","severity":"gotcha","affected_versions":">=1.15.0"},{"fix":"Add `\"esModuleInterop\": true` to tsconfig.json.","message":"TypeScript users must enable `esModuleInterop` or `allowSyntheticDefaultImports` to use the default import. Otherwise, use `import * as sass from 'rollup-plugin-sass'`.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check the plugin documentation for the latest callback signature.","message":"The `output` option as a function receives `(styles, styleNodes)`. The second argument `styleNodes` may be deprecated in future; prefer the new API.","severity":"deprecated","affected_versions":">=1.14.0"},{"fix":"Use the `include` or `exclude` options to restrict which files are processed.","message":"In v1.13.0, `*.css` file support was added to the default sass file importer. This may cause unexpected imports if you have CSS files alongside SCSS.","severity":"breaking","affected_versions":">=1.13.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install sass --save-dev","cause":"Missing peer dependency `sass`.","error":"Error: The 'sass' package is required to use this plugin. Please install it: npm install sass"},{"fix":"Ensure the plugin is added to the Rollup plugins array and the file extension is included in the import.","cause":"Rollup cannot resolve the SCSS file; plugin not processing it.","error":"[!] Error: Could not resolve './styles.scss' from 'index.js'"},{"fix":"Ensure processor returns an object with a `css` property, or a promise that resolves to such an object.","cause":"Processor callback returns a promise that resolves to undefined or malformed object.","error":"TypeError: Cannot read properties of undefined (reading 'css')"},{"fix":"Create the output directory or use a path that exists.","cause":"The `output` option is set to a path where the directory does not exist.","error":"Error: ENOENT: no such file or directory, open 'bundle.css'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}