fix(postcss-preset-env): client side polyfills #3051
|
@ -72,7 +72,17 @@ export default defineConfig(({mode}) => {
|
|||
plugins: [
|
||||
postcssEasings(),
|
||||
postcssEasingGradients(),
|
||||
dpschen marked this conversation as resolved
Outdated
|
||||
postcssPresetEnv(),
|
||||
postcssPresetEnv({
|
||||
// Since postcss-preset-env v8.0.0 the 'enableClientSidePolyfills' option is disabled by default.
|
||||
// This is the list of features that require a client side library:
|
||||
// https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env#plugins-that-need-client-library
|
||||
// Since we only use 'focus-within-pseudo-class' we have to force enable
|
||||
// that plugin now manually in order to keep the browser support as it was.
|
||||
// See also './src/polyfills.ts'
|
||||
features: {
|
||||
'focus-within-pseudo-class': true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
Reference in New Issue
Now that I enabled the former default again, I'm unsure if I would need to disable the other plugins again as well.
Maybe it's also enough to do the opposite: force enable the focus-visible-pseudo-class plugin like this:
AFAIK 'focus-visible-pseudo-class' is the only feature of those plugins that require a client side polyfill that we use.
When I read the documentation of that plugin I get a bit confused though if we even need that
src/polyfills.ts
file or if enabling that plugin should be enought for the client side polyfill to be included. See that sentence:Source: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-focus-within#browser
Really confusing that documentation!
If it's possible to enable the polyfill only for that specific feature I think that's a good idea. Or is the rest tree-shaked?
That sounds like it does not need a polyfill at all? (When targeting newer browsers than these)
I'm unsure.
It's also very time-consuming to test this since I would need to pick a browser version in browserslist that doesn't support those features natively.
Should I try the variant where I only enable features?
If that's easier, please do.
Done. Please re-review