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

You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. #405

Closed
trigun539 opened this issue Mar 19, 2019 · 39 comments

Comments

@trigun539
Copy link

Have tried a bunch of configurations from the documentation but postcss-loader is not picking up the postcss plugins. I had the configuration working on webpack v3 using older versions of the libraries/plugins. Upgraded to webpack v4 and latest plugins versions and now postcss can't pickup the plugin configuration.

Details

Configuring postcss-loader with following plugins:

  • precss
  • autoprefixer
  • lost

Error (Logs|Stacks)

You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.

Reproduction (Code)

Please see:

https://gist.github.com/trigun539/2b8ebf739b64881ec0b3ea2a9e37ba92

Environment

OS: Windows
node: 8.15.0
npm: 6.4.1
postcss-loader: 3.0.0
precss: 4.0.0
autoprefixer: 9.4.10
lost: 8.1.0
mini-css-extract-plugin: 0.5.0

@alexander-akait
Copy link
Member

Because you do not have plugins for postcss-loader, it is error from postcss

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Mar 19, 2019

@trigun539 Rename postcss.conf.js to postcss.config.js and it should work. See https://github.com/michael-ciniawsky/postcss-load-config#usage for more info about valid config names/conventions

@trigun539
Copy link
Author

@michael-ciniawsky Sorry the file actually is postcss.config.js. It is still not working.

@trigun539
Copy link
Author

Because you do not have plugins for postcss-loader, it is error from postcss

I have precss/autoprefixer/lost postcss plugins that should work.

@eric-beaufol
Copy link

If you have the same problem, i've found an explication/solution here :
postcss/postcss#1247

@ShaileshInfyom
Copy link

ShaileshInfyom commented Jul 20, 2019

any solution? i getting the same issue

You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them

@ShaileshInfyom
Copy link

ShaileshInfyom commented Jul 23, 2019

any solution? i getting the same issue

You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them

I got a solution. i using a laravel mix. solution found here

@ahamid
Copy link

ahamid commented Sep 18, 2019

As an aside, I have discovered that despite a valid (webpack) postcss-loader configuration with plugins present, from what I can tell postcss-advanced-variables will cause this error to be emitted since it apparently invokes postcss internally without plugins; I'm not sure if this is a bug per se, or whether there is some way to refrain from warning when explicitly invoked like this.

https://github.com/jonathantneal/postcss-advanced-variables/blob/master/src/lib/transform-import-atrule.js#L75

@wadtech
Copy link

wadtech commented Sep 18, 2019

Is it possible to get more of a stack trace for this error? I'm getting it now but everything seems to be working correctly otherwise. I presume it's some other dependency somewhere in the tree.

@ahamid
Copy link

ahamid commented Sep 18, 2019

@wadtech I just dumped a couple of console.logs in postcss processor.js process function, that's how I tracked the source of mine down

@AntonioRedondo
Copy link

I was receiving this error on console even when my CSS was processed with no problems. In my case was due to @import statements on CSS files. Adding postcss-import fixed the issue but this plug-in is redundant since @import statements are already tackled by css-loader.

@bensampaio
Copy link

I am trying to upgrade to postcss@8.0.5, postcss-loader@4.0.2 and autoprefixer@10.0.0 but I am getting this issue as well. Webpack seems to build as expected but prints these warnings a lot of times before printing the final output. I noticed that I only get these warning in development mode.

Here's my updated loader config:

loader: 'postcss-loader',
    options: {
        postcssOptions: {
            plugins: [
                ['autoprefixer', {
                    overrideBrowserslist: targets,
                }],
            ],
        },
        sourceMap: true,
    },
}

Any idea what could be causing this issue?

@alexander-akait
Copy link
Member

@bensampaio Do you use monorepos?

@bensampaio
Copy link

@evilebottnawi yes, I do. Is that the cause of the issue?

@alexander-akait
Copy link
Member

alexander-akait commented Sep 18, 2020

@bensampaio some packages doesn't have postcss.config.js, you need to put it in each packages or in root or setup in loader using config

@bensampaio
Copy link

@evilebottnawi I am putting it in the loader as I showed above:

loader: 'postcss-loader',
    options: {
        postcssOptions: {
            plugins: [
                ['autoprefixer', {
                    overrideBrowserslist: targets,
                }],
            ],
        },
        sourceMap: true,
    },
}

I can't move this configuration to postcss.config.js because the value of overrideBrowserslist is dynamic. In any case I tried creating a postcss.config.js on every package in my monorepo and this issue still remains. In my webpack config I use mini-css-extract-plugin, css-loader, sass-loader, postcss-loader and optimize-css-assets-webpack-plugin. Could it be related to any of these? Do they use postcss internally without configuration?

@bensampaio
Copy link

If I remove postcss-loader from my configuration then the problem is gone. But this isn't exactly what I want xD

@alexander-akait
Copy link
Member

@bensampaio Please:

  • migrate from optimize-css-assets-webpack-plugin on https://github.com/webpack-contrib/css-minimizer-webpack-plugin, it is official css plugin for minimizing with cache/parallels/source maps/etc
  • In any case I tried creating a postcss.config.js on every package in my monorepo and this issue still remains, you need to put it in root, because you compile files from node_modules and we don't know which plugins should be used there

@bensampaio
Copy link

bensampaio commented Sep 19, 2020

@evilebottnawi I did create a postcss.config.js file in the root of my monorepo. That didn't fix the issue :/ And this was just a test anyway because as I mentioned my postcss config needs to be in the loader. I have multiple webpack configs running with different browserslist configurations and as far as I know there's no way I can move that out from my webpack configs. If this loader offers options to configure postcss then I would expect that to be enough... Is there anyway I can help figure out the source of these warnings since none of the solutions so far helped?

I will migrate to css-minimizer-webpack-plugin as you mentioned, thank you!

@alexander-akait
Copy link
Member

alexander-akait commented Sep 19, 2020

@bensampaio Please create reproducible test repo, I can't help without code

@vwpo
Copy link

vwpo commented Sep 20, 2020

@bensampaio did you solve the problem? I have exactly the same error! I also use mini-css-extract-plugin, css-loader and monorepos

@bensampaio
Copy link

bensampaio commented Sep 23, 2020

@evilebottnawi I am trying to reproduce the issue in this repo: https://github.com/bensampaio/postcss-monorepo-issue. However, webpack doesn't even seem to be able to resolve the postcss-loader while it is able to resolve all the other loaders. I am not sure if this is related but it is definitely weird that I only get this issue with postcss-loader. Could you have a look?

@alexander-akait
Copy link
Member

@bensampaio Because you run run build:dev in @test/app workspace but there are no loaders for @test/app, sorry problems is not related to webpack or postcss-loader, why it is work for babel-loader, because it is hoist to node_modules/babel-loader, but no node_modules/postcss-loader

@alexander-akait
Copy link
Member

More information yarnpkg/yarn#7572

@Arvi2k17
Copy link

I was getting this warning in my NX workspace . I don't know how to find the webpack in my NX workspace and post config.css , I tried creating a webpack.conf.js and post.config.js but didn't solved my problem . Can anyone guide me on this ?

image

This is my project structure
image

@Bessonov
Copy link

you need to put it in root, because you compile files from node_modules and we don't know which plugins should be used there

Thanks @alexander-akait , that helped me to make tailwindcss work in a monorepo. Probably, it should be stated in docs.

@alexander-akait
Copy link
Member

@Bessonov feel free to send PR to docs

@Bessonov
Copy link

@alexander-akait I don't feel like I have enough background information to put it into proper and precise wording. For example, it isn't clear for me why it works this way. I start the process from a sub-module and expect that the configuration in this sub-module should be enough. And how it's expected to work, if there are multiple frontend modules which requires different postcss configuration.

@alexander-akait
Copy link
Member

it is due module hoist in monorepos and default cwd...

@jvxiao
Copy link

jvxiao commented Aug 30, 2021

I meet the same problem when I use autoprefixer plugin. I tried many solutions I've found by Google , none of they woked. But ironically, it's just beacuse I just wrote plugin rather plugins in postcss.config.js.

@sarink
Copy link

sarink commented Oct 5, 2021

Is there any way to disable this yet? I'm using next.js and the docs clearly state you can disable postcss during development https://nextjs.org/docs/advanced-features/customizing-postcss-config#customizing-plugins however if I do this, my terminal is flooded with warnings.

@davidlowry
Copy link

This error message can also happen if your yarn config has changed and you haven't yet re-run yarn install - and it'll usually be paired with an unstyled CSS output from the otherwise functioning webpack server. yarn install (etc.) resolved for me. Specific scenario was I had made changes on one machine, pushed to production and pulled back from repo to another machine; hit 'guard' and got that message, and mostly unstyled output on localhost.

@findawayer
Copy link

In my case, changing the value of plugins property from function to array has solved the issue.

Before:

module.exports = {
  plugins: () => [
    require('postcss-preset-env'),
    require('cssnano'),
  ],
};

After:

module.exports = {
  plugins: [
    require('postcss-preset-env'),
    require('cssnano'),
  ],
};

Seems like people have different experience on this, I just want to share mine.

@axlroseart
Copy link

I am trying to upgrade to postcss@8.0.5, postcss-loader@4.0.2 and autoprefixer@10.0.0 but I am getting this issue as well. Webpack seems to build as expected but prints these warnings a lot of times before printing the final output. I noticed that I only get these warning in development mode.

Here's my updated loader config:

loader: 'postcss-loader',
    options: {
        postcssOptions: {
            plugins: [
                ['autoprefixer', {
                    overrideBrowserslist: targets,
                }],
            ],
        },
        sourceMap: true,
    },
}

Any idea what could be causing this issue?

try this:
plugins: [ require('autoprefixer'), ],
this worked for me.

@najathi
Copy link

najathi commented Dec 14, 2021

npm i --save-dev postcss postcss-focus postcss-preset-env postcss-flexbugs-fixes

copy to package.json

"peerDependencies": {
    "postcss": "..."
 }

more config checkout this link: https://evilmartians.com/chronicles/postcss-8-plugin-migration

create postcss.config.js:

module.exports = {
    plugins: [
        'postcss-flexbugs-fixes',
        [
            'postcss-preset-env',
            {
                autoprefixer: {
                    flexbox: 'no-2009',
                },
                stage: 3,
                features: {
                    'custom-properties': false,
                },
            },
        ],
        require('postcss-focus'),
    ]
}

@GoulartNogueira
Copy link

If you are on Nuxt.js and just want to remove the anoying warning, this will solve:

#405

@elcferreira
Copy link

If you are on Nuxt.js and just want to remove the anoying warning, this will solve:

#405

I'm also having this problem on Nuxt.js, once I click on your link I back to this issue.

Have you an idea which solution could I apply on Nuxt.js?

@aemg93
Copy link

aemg93 commented Oct 20, 2022

in the nuxt.config.js file
build: {
postcss: null,
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests