rollup-plugin-sass-migrator
raw JSON → 1.0.5 verified Mon Apr 27 auth: no javascript
Rollup/Vite plugin to run the sass-migrator tool on SASS files during development and build, primarily to eliminate deprecation warnings from the SASS compiler. Version 1.0.5 (stable) has a peer dependency on sass-migrator ^1. Designed to simplify automatic migration by integrating into the build pipeline, with special support for Quasar projects via a convenience function. Unlike manual migration, it automates migration on every build, ensuring existing warnings are resolved.
Common errors
error Error: Cannot find module 'sass-migrator' ↓
cause Missing peer dependency sass-migrator
fix
npm install -D sass-migrator
error TypeError: sass_migrator is not a function ↓
cause Importing default export instead of named export
fix
Use import { sassMigrator } from 'rollup-plugin-sass-migrator'
Warnings
breaking Peer dependency 'sass-migrator' is required but may be missing if not installed. ↓
fix Install peer dependency: npm install -D sass-migrator or yarn add -D sass-migrator
gotcha Plugin only supports ESM imports; CommonJS require may fail in some setups. ↓
fix Use import syntax or ensure your build tool handles CJS require of ESM packages (e.g., using a bundler like Rollup).
gotcha The plugin does not automatically detect sass-migrator configuration; you must specify indexPath or use the Quasar convenience function. ↓
fix Pass either indexPath option to sassMigrator or use sassMigratorQuasar() for Quasar projects.
Install
npm install rollup-plugin-sass-migrator yarn add rollup-plugin-sass-migrator pnpm add rollup-plugin-sass-migrator Imports
- sassMigrator wrong
import sassMigrator from 'rollup-plugin-sass-migrator'correctimport { sassMigrator } from 'rollup-plugin-sass-migrator' - sassMigratorQuasar wrong
const sassMigratorQuasar = require('rollup-plugin-sass-migrator')correctimport { sassMigratorQuasar } from 'rollup-plugin-sass-migrator' - sassMigrator (Rollup) wrong
const sassMigrator = require('rollup-plugin-sass-migrator').default;correctconst { sassMigrator } = require('rollup-plugin-sass-migrator');
Quickstart
// vite.config.js
import { defineConfig } from 'vite';
import { sassMigrator } from 'rollup-plugin-sass-migrator';
export default defineConfig({
plugins: [
sassMigrator({
indexPath: 'node_modules/quasar/src/css/index.sass',
debug: false,
dryRun: false,
})
]
});