Open MartinManev opened 2 years ago
I'll do some more testing.postcss-prefix-selector
might be the one to blame.
I tested with a custom PostCSS plugin that only prints a message in the console and the issue is still present. I saw that when css.extract = true, then Vue CLI uses MiniCssExtractPlugin
and it is working as expected. But when css.extract = false it is doing something else - not sure what exactly. I'll take look at it again tomorrow.
All PostCSS plugins run twice when css.extract = false. What's different about autoprefixer
is that it has some mechanism to avoid adding redundant selectors, but it also runs twice. I am having trouble debugging the Vue CLI itself - there are multiple dependency incompatibilities when I try to install. Could any of the maintainers take a look at this problem?
Version
5.0.8
Environment info
Steps to reproduce
In vue.config.js add the following:
In postcss.config.js add the following:
I've installed
postcss-prefix-selector
, but the issue is about postcss plugins in general.Build the project
In the resulting dist/js/app.xxxxx.js you will see that the postcss plugins have run twice on the same CSS content.
For me I see the following:
Input:
Output:
Also, in the configuration for
postcss-prefix-selector
you can provide a transform function, where if you put aconsole.log
, you will see that it is run twice on the same file and prefix.What is expected?
PostCSS plugins are only run once.
What is actually happening?
PostCSS plugins are run two times on the same CSS content.