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

Update @wordpress/scripts to use PostCSS 8 #27028

Closed
andrewstaffell opened this issue Nov 17, 2020 · 10 comments · Fixed by #27821 or #30347
Closed

Update @wordpress/scripts to use PostCSS 8 #27028

andrewstaffell opened this issue Nov 17, 2020 · 10 comments · Fixed by #27821 or #30347
Assignees
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Package] Scripts /packages/scripts [Status] In Progress Tracking issues with work in progress

Comments

@andrewstaffell
Copy link

andrewstaffell commented Nov 17, 2020

Many PostCSS plugins are now requiring PostCSS 8, and so resources using @wordpress/scripts are failling to npm run build with latest module versions, throwing errors like:

ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: PostCSS plugin postcss-import requires PostCSS 8.

I think it's enough to bump the version of postcss-loader in @wordpress/scripts to >= 4.0.3.

@andrewstaffell andrewstaffell changed the title Upgrade @wordpress/scripts to use PostCSS 8 Update @wordpress/scripts to use PostCSS 8 Nov 17, 2020
@gziolo gziolo added [Package] Scripts /packages/scripts Needs Dev Ready for, and needs developer efforts labels Nov 19, 2020
@gziolo gziolo added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Dec 12, 2020
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Dec 18, 2020
@ocean90
Copy link
Member

ocean90 commented Dec 19, 2020

To make sure we can use PostCSS 8 we have to wait a bit I think

@andrewstaffell
Copy link
Author

Thanks for the update @ocean90. Is there any known workaround for this issue in the meantime? As it stands resources are failing to compile with @wordpress/scripts... and plugins like postcss-import are pretty basic and hard to avoid. I tried npm shrinkwrap around the time I filed the issue but without success.

@ocean90
Copy link
Member

ocean90 commented Dec 19, 2020

Don't update plugins which require PostCSS 8. 🙈
I'm not aware of any workarounds but what I'd try is to use npm package alias and a custom webpack config. Something like npm install postcss-loader-4@npm:postcss-loader@4 and loader: require.resolve( 'postcss-loader-4' ).

@gziolo
Copy link
Member

gziolo commented Jan 23, 2021

https://www.npmjs.com/package/postcss-custom-properties v11 is now listing PostCSS v8 as a peer dependency 🎉

Storybook merged a PR on their end as well but it’s still part of the alpha release line: storybookjs/storybook#13640

@shivapoudel
Copy link
Contributor

@gziolo Any updates regarding PostCSS v8 implementation?

@gziolo
Copy link
Member

gziolo commented Feb 8, 2021

We could give it a try and find a way to make Storybook work with PostCSS 7 and everything else with PostCSS 8.

@gziolo
Copy link
Member

gziolo commented Mar 17, 2021

#27821 is now updated and everything seems to work with PostCSS v8. The only caveat is that we have Strorybook set to the prerelease version: v6.2.0-rc.2, but it works so personally think it's a good trade-off.

@gziolo gziolo reopened this Mar 29, 2021
@gziolo
Copy link
Member

gziolo commented Mar 29, 2021

Reverted in #30320 by @noisysocks due to issues with wp-scripts start in Gutenberg. It was also reported in #27821 (comment) by @stokesman.

@gziolo
Copy link
Member

gziolo commented Mar 29, 2021

Another attempt in #30347.

@interglobalmedia
Copy link

Hi, POSTCSS 8.3.0 is not working for me. Have no errors, but when I updated all npm packages yesterday including webpack to 5.38.1, my styles are not being added to the head in html. So No styling and no JS that depends on the styles to work. No errors in the console, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Package] Scripts /packages/scripts [Status] In Progress Tracking issues with work in progress
Projects
None yet
5 participants