This is my postcss configuration code in rollup.config.js file:
const postcssUrlOpts = [
{
url: 'copy',
filter: /\.woff$/,
assetsPath: 'font'
}
];
const postcssOpts = {
extract: 'index.css',
plugins: [
postcssUrl(postcssUrlOpts)
]
};
And this is the log that I get:
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/.../node_modules/rollup-plugin-postcss/node_modules/postcss/lib/processor.es6:130:15)
at new Processor (/.../node_modules/rollup-plugin-postcss/node_modules/postcss/lib/processor.es6:38:25)
at postcss (/.../node_modules/rollup-plugin-postcss/node_modules/postcss/lib/postcss.es6:34:10)
at /.../node_modules/rollup-plugin-postcss/dist/index.js:213:28
at Generator.next (<anonymous>)
at asyncGeneratorStep (/.../node_modules/rollup-plugin-postcss/dist/index.js:19:24)
at _next (/.../node_modules/rollup-plugin-postcss/dist/index.js:41:9)
Without postcssUrl plugin all my css imports in javascript files are working and everything is fine but when I add this plugin to the list of postcss plugins I get this error in my console. Any other plugin like tailwindcss plugin works just fine.
versions:
postcss: ^8.1.10
postcss-url: ^10.1.1
The elements of the
pluginsarray should be functions. You're calling the function immediately and returning the object. Wrap the function call in a function.