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

Do not require postcss.config.js name when using config.path option #358

galvarez421 opened this Issue May 3, 2018 · 2 comments


None yet
3 participants
Copy link

galvarez421 commented May 3, 2018


Is there a reason that the config path cannot point to a module that does not have the name postcss.config.js? I created a shareable PostCSS config file with the intention to reuse it across multiple projects, and I assumed that if I pointed to this file using the config.path then the file would work regardless of it name. I certainly don't mind renaming the config file in my shareable config package to postcss.config.js, but I thought I would ask if this naming convention is necessary in a case where the path to the config file is explicit. Loosening this convention would also seem to allow for the possibility of multiple shareable PostCSS configs in a single package (see for an example).

Error Log

From Webpack output:

Module build failed: Error: No PostCSS Config found in: C:\myproject\node_modules\my-shareable-postcss-config\index.js

Reproduction [Code]

In Webpack config:

  loader: 'postcss-loader',
  options: {
    config: {
      path: path.resolve(__dirname, 'node_modules/my-shareable-postcss-config/index.js'),
    sourceMap: true,


Please provide information about your environment.

OS node npm postcss-loader
Windows 7 Enterprise 8.94 4.6.1 2.1.4

This comment has been minimized.

Copy link

evilebottnawi commented May 3, 2018

@galvarez421 looks like bug inside postcss-load-config package
Feel free investigate and send PR 👍


This comment has been minimized.

Copy link

michael-ciniawsky commented May 4, 2018

The name is an hardcoded requirement of cosmiconfig and 'enforces' are convention which is intended. You are revering to extends within eslintrc configs which isn't currently supported by postcss.config.js directly. A postcss.config.js file is scoped to the project, but you may require() a preset shared through an node module as follows


module.exports = require('my-preset')(options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment