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–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import postcssNestedOnce from 'postcss-nested-once'
✗ const postcssNestedOnce = require('postcss-nested-once').default
Default export is a function that creates the PostCSS plugin.
n/a (plugin factory)
✓ postcssNestedOnce() in PostCSS plugins array
✗ postcssNestedOnce (without calling as function)
Must be called as a function to produce a plugin instance; passing the function directly will error.
n/a (CommonJS)
✓ const postcssNestedOnce = require('postcss-nested-once')
✗ const postcssNestedOnce = require('postcss-nested-once').default
CJS import is straightforward; using .default is incorrect and yields undefined.
Shows how to configure rollup-plugin-styles with postcss-nested-once for CSS Modules support with nested ampersand selectors.
// rollup.config.js
import styles from 'rollup-plugin-styles';
import postcssNestedOnce from 'postcss-nested-once';
export default {
plugins: [
styles({
mode: 'inject',
modules: true,
plugins: [
postcssNestedOnce(),
],
}),
],
};
Errors
Common errors & fixes
Cannot find module 'postcss-nested-once'
Package not installed or incorrect import path.
fixInstall: npm install postcss-nested-once --save-dev
TypeError: postcssNestedOnce is not a function
Importing the package but not calling it as a function.
fixUse postcssNestedOnce() (with parentheses) in plugins array.
Cannot read properties of undefined (reading 'list_item')
Using postcss-nested instead of postcss-nested-once; ampersand-combined selectors not generating correct class names.
fixReplace postcss-nested with postcss-nested-once in plugins.
Audit
Dependencies
postcssrequiredpeer dependency, requires ^8.3.5