When using the following in my Webpack config:
{
test: /\.scss$/i,
use: [
'style-loader',
{
loader: 'css-loader',
options: { importLoaders: 1 },
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
[
'postcss-preset-env'
],
],
},
},
},
"sass-loader"
],
},
I'm noticing that sometimes CSS rules like the following are removed from the bundled CSS output.
img {
margin-inline-end: 1rem;
}
When removing the above Webpack config, the rule above is applied as expected.
More specifically:
- when an
[dir="rtl"]attribute is set on thehtmlelement, themargin-inline-end: 1rem;style exists - when the
dirattribute is not set, themargin-inline-end: 1rem;style does not exist in the bundled output - when the
'postcss-preset-env'plugin is removed, themargin-inline-end: 1rem;style exists regardless of the presence of the[dir]attribute
What is causing this behavior and how can I disable it while continuing to use postcss-preset-env for other things like autoprefixer?