tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

[v4] including @tailwindcss/vite in plugins breaks css modules in production

Open abhishiv opened this issue 1 year ago • 2 comments

What version of Tailwind CSS are you using?

4.0.0-beta.1

What build tool (or framework if it abstracts the build tool) are you using?

@tailwindcss/[email protected] with [email protected]

What version of Node.js are you using?

v20.5.0

What browser are you using?

Chrome

What operating system are you using?

macOS

Describe your issue

Following vite.config.js makes vite generate incorrect css class name for css modules

  plugins: [tailwindcss()],
  css: {
    postcss: {},
    modules: {
      generateScopedName: "[local]__[hash:base64:5]",
    },
  },

Maybe related, but I see following error in production


[plugin @tailwindcss/vite:generate:build] Sourcemap is likely to be incorrect: a plugin (@tailwindcss/vite:generate:build) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help

abhishiv avatar Nov 23 '24 21:11 abhishiv

Hey @abhishiv! Thanks for the report. Do you mind uploading a reproduction repository for us to check out? I was just testing your config in our Vite playground and it seems to work as expected for both dev and production builds:

Screenshot 2024-11-25 at 10 43 07

philipp-spiess avatar Nov 25 '24 09:11 philipp-spiess

@abhishiv Going to close this one for now but if you have a repro that you can share with us, please feel free to reply here or create a new issue, thank you!

philipp-spiess avatar Dec 05 '24 10:12 philipp-spiess

Seems to map to this issue : https://github.com/tailwindlabs/tailwindcss/discussions/16119

bencodesall avatar May 28 '25 00:05 bencodesall