Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "[object Object] is not a PostCSS plugin" when using with Laravel Mix #145

Open
Nikschavan opened this issue Jul 15, 2021 · 2 comments · May be fixed by #146
Open

Error "[object Object] is not a PostCSS plugin" when using with Laravel Mix #145

Nikschavan opened this issue Jul 15, 2021 · 2 comments · May be fixed by #146

Comments

@Nikschavan
Copy link

Laravel Mix internally uses webpack and allows you to add postcss plugins.

I am trying to use it with postcss-flexibility, although I am seeing this following error log -
This error only happens with this postcss plugin, I tried a few other plugins and this error does not seem to occur.

✖ Mix
  Compiled with some errors in 296.11ms

ERROR in ./sass/site/navigation/menu-animation.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
    at Processor.normalize (/Users/Nik/Projects/path/to/node_modules/postcss/lib/processor.js:63:15)
    at new Processor (/Users/Nik/Projects/path/to/node_modules/postcss/lib/processor.js:10:25)
    at postcss (/Users/Nik/Projects/path/to/node_modules/postcss/lib/postcss.js:26:10)
    at Object.loader (/Users/Nik/Projects/path/to/node_modules/postcss-loader/dist/index.js:96:17)
    at processResult (/Users/Nik/Projects/path/to/node_modules/webpack/lib/NormalModule.js:701:19)
    at /Users/Nik/Projects/path/to/node_modules/webpack/lib/NormalModule.js:807:5
    at /Users/Nik/Projects/path/to/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/Nik/Projects/path/to/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/Nik/Projects/path/to/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at Object.loader (/Users/Nik/Projects/path/to/node_modules/postcss-loader/dist/index.js:142:7)

1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
@Nikschavan Nikschavan changed the title Error "Error: [object Object] is not a PostCSS plugin" when using with Laravel Mix Error "[object Object] is not a PostCSS plugin" when using with Laravel Mix Jul 15, 2021
@Nikschavan
Copy link
Author

I have reproduced this in this repo - https://github.com/Nikschavan/laravel-mix-error

You can clone this repo, run npm install and then npm run build to se the error. I was able to fix this error with some changes in the plugin definition by checking the postcss blilerplate plugin although I am not sure if this is the right approach, would love to get some feedback.

@Nikschavan
Copy link
Author

I am getting similar error when using this in grunt with @lodder/grunt-postcss

Warning: [object Object] is not a PostCSS plugin Use --force to continue.

The PR #146 seems to be fixing this when using it with grunt as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant