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

[v4] Publish @tailwindcss/postcss as ESM #13692

Closed
wesbos opened this issue May 16, 2024 · 2 comments
Closed

[v4] Publish @tailwindcss/postcss as ESM #13692

wesbos opened this issue May 16, 2024 · 2 comments

Comments

@wesbos
Copy link
Contributor

wesbos commented May 16, 2024

"@tailwindcss/postcss": "^4.0.0-alpha.15" is currently published as CJS, while "@tailwindcss/vite": "^4.0.0-alpha.15" is published as ESM.

Trying to use the postcss plugin inside a vite config file like this (with type: module set in package.json)

import tailwindcssPostCSS from '@tailwindcss/postcss'
import { defineConfig } from 'vite'
export default defineConfig({
  css: {
    postcss: {
      plugins: [tailwindcssPostCSS]
    },
  },
})

Causes this issue:

✘ [ERROR] Failed to resolve entry for package "@tailwindcss/postcss". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." specifier in "@tailwindcss/postcss" package [plugin externalize-deps]

node_modules/esbuild/lib/main.js:1374:27:
  1374 │         let result = await callback({
       ╵                            ^

a workaround currently is to use an external postcss.config.js file:

export default {
  plugins: {
    "@tailwindcss/postcss": {},
  },
};
@wesbos
Copy link
Contributor Author

wesbos commented May 16, 2024

Ah - the exports are incorrect. This package is fine as CJS, as long as we fix the exports.

#13693

@RobinMalfait
Copy link
Contributor

Hey!

This should be fixed by #13693, and will be available in the next release.

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

2 participants