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
Update postcss to 8.x #488
Comments
Laravel Mix is moving to Postcss 8 in the next major version, which is giving some compatibility issues in https://github.com/spatie/laravel-mix-purgecss. |
@sebastiandedeyne, what compatibility issue are you seeing? I understood that PostCSS 7 plugins would also work with PostCSS 8. |
I'm gonna dive back into this later this week, but to my understanding there wasn't really a problem with Purgecss being compatible with PostCSS 8, but a dependency issue. Laravel Mix 8 requires PostCSS 8, while postcss-purgecss requires PostCSS 7. This causes two separate PostCSS versions to be installed, throwing weird dependency errors. |
Yeah, with the release of PostCSS 8 it's now recommended that postcss plugins list PostCSS as a peer dependency instead of a direct dependency. |
We just updated Tailwind to PostCSS 8 and using the current version of PurgeCSS that still uses PostCSS 7 has not been a problem at all for what it’s worth. PostCSS 8 is designed to work fine alongside other installations of PostCSS 7. You get a slightly annoying console warning about using a deprecated API but it works 👍🏻 |
Interesting, I suppose the error was cause by something else. Gonna give this another try next week! |
Update: when PurgeCSS is installed, it forces my test project to use PostCSS 7 over 8, which triggers an error on other packages that already require PostCSS 8.
That said, if I explicitly define a yarn resolution, the build passes without any issues, and everything gets purged correctly. So I can report that PurgeCSS runs on PostCSS 8 without any issues. (at least for my small test file) "resolutions": {
"postcss": "8.1.2"
} |
@sebastiandedeyne Can you share a test project? Curious what would cause that. Mix should be requiring PostCSS 8 as a dependency itself, so it should use the correct version otherwise npm/yarn have a bug which doesn't sound likely for super basic require stuff 🤔 |
Sure! You can check out this branch: spatie/laravel-mix-purgecss#90 In the repo, |
@sebastiandedeyne Looks like just running We have to update all of the Tailwind installation instructions for example to |
@sebastiandedeyne Looks like you should be doing that actually, installing |
We have this issue with Laravel Mix too. The most prevalent version of PostCSS gets hoisted so postcss-loader gets postcss 7 but Laravel Mix gets postcss 8 when requiring. I'm investigating adding postcss directly to the root package json after the user installs mix to get around it. |
@thecrypticace I think best solution for Mix is to just include postcss in the default Laravel webpack.mix.js file. For people installing Mix separately, you should just make the installation instructions |
Is it fully resolved now with beb4a59? Can anyone give a hint when a new version with that change will be released? |
@ikornienko I published a new version with @next tag that contains this change. I'll let you know when it's part of a non-beta release.
|
The PostCSS plugin has been updated to use PostCSS 8 and has dropped support to PostCSS 7 with version 4.0+. |
Not sure how hard this will be, but I didn't find a similar issue. Note that most projects moved postcss to a peer dependency.
The text was updated successfully, but these errors were encountered: