webpack-contrib / postcss-loader

PostCSS loader for webpack
MIT License
2.86k stars 211 forks source link

Loading PostCSS "tailwindcss" plugin failed: Cannot find module 'tailwindcss' #600

Closed ptgamr closed 1 year ago

ptgamr commented 2 years ago

Bug report

Upgrading to latest version of postcss - https://github.com/postcss/postcss/releases/tag/8.4.16

Build failed with standard configuration of webpack + postcss-loader + tailwindcss

Loading PostCSS "tailwindcss" plugin failed: Cannot find module 'tailwindcss'

Downgrade to 8.4.14 the build is fine again

Actual Behavior

Build failed

Expected Behavior

Build should not failed

How Do We Reproduce?

// webpack config
      {
        test: /\.tailwind\.css$/i,
        use: [
          'style-loader',
          {loader: 'css-loader', options: {importLoaders: 1}},
          'postcss-loader',
        ],
      },

// postcss.config.js
module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}

// tailwind.config.js
module.exports = {
  mode: 'jit',
  future: {
    removeDeprecatedGapUtilities: true,
    purgeLayersByDefault: true,
  },
  content: ['./src/**/*.tsx'],
  theme: {},
  variants: {},
  plugins: [],
  corePlugins: {
    preflight: false,
  },
}
alexander-akait commented 2 years ago

It means you don't have installed tailwindcss

ptgamr commented 2 years ago

I'm sure tailwindcss is installed - that's why "Downgrade to 8.4.14 the build is fine again"

alexander-akait commented 2 years ago

Sounds like a bug in PostCSS, we don't have 8.4.14 version, we just PostCSS runner, not more, can you create reproducible test repo?

teezyben1 commented 1 year ago

am having the same problem here

alexander-akait commented 1 year ago

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!