Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ const sassMiddleware = require('express-dart-sass');
✗ import sassMiddleware from 'express-dart-sass';
This package is CommonJS only; it does not provide ESM exports. Use require().
default (ESM style)
✓ import sassMiddleware from 'express-dart-sass';
// Works only if your project is configured for ESM interop.
✗ import { sass } from 'express-dart-sass';
The package's module field points to an ESM wrapper? Actually it's CJS; some bundlers allow default import. Named import does not exist.
Options interface
✓ // No type exports; define your own interface based on docs
✗ import { Options } from 'express-dart-sass';
The package does not ship TypeScript declarations. Use @types/express-dart-sass? There are none.
Sets up express-dart-sass middleware to compile SCSS files from src to dest with compressed output, then serves static files.
const express = require('express');
const sassMiddleware = require('express-dart-sass');
const path = require('path');
const app = express();
app.use(sassMiddleware({
src: __dirname,
dest: path.join(__dirname, 'public'),
debug: true,
outputStyle: 'compressed',
prefix: '/prefix'
}));
app.use(express.static(path.join(__dirname, 'public')));
app.listen(3000, () => console.log('Server running on port 3000'));
Errors
Common errors & fixes
Error: Cannot find module 'sass'
The package depends on dart-sass (the `sass` npm package) which is not installed.
fixnpm install sass --save
TypeError: sassMiddleware is not a function
CommonJS require returns an object with a default property when using ESM-style import in a CJS environment? Actually, the package exports a function directly, but if you use `import sassMiddleware from 'express-dart-sass'` in a TypeScript project with esModuleInterop: false, it may cause issues.
fixUse `const sassMiddleware = require('express-dart-sass')` or enable esModuleInterop in tsconfig. Audit
Dependencies
expressrequiredThe middleware is designed to work with Express; it uses Express-style request/response objects.
sassrequireddart-sass (the sass npm package) is required for compiling Sass files.