postcss / postcss-url

PostCSS plugin to rebase url(), inline or copy asset.
MIT License
377 stars 60 forks source link

[help] Error: [object Object] is not a PostCSS plugin #155

Closed samadadi closed 3 years ago

samadadi commented 3 years ago

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.

versions:

postcss: ^8.1.10
postcss-url: ^10.1.1
Spittal commented 3 years ago

I had the same issue, I downgraded to ^9.0.0 to workaround.

sergcen commented 3 years ago

I'll check

sergcen commented 3 years ago

probably problem in https://github.com/egoist/rollup-plugin-postcss/blob/master/package.json#L59 It uses 7.x postcss version

samadadi commented 3 years ago

There is pull request to enable postcss 8.

samadadi commented 3 years ago

rollup-plugin-postcss uses postcss 8 now & the problem is gone. So I am closing this issue. Thanks for your help .