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

Fix @headlessui/tailwindcss exports map #3539

Closed
wants to merge 1 commit into from

Conversation

philipp-spiess
Copy link
Member

When trying to load the @headlessui/tailwindcss package from a v4 project via:

@import '@headlessui/tailwindcss';

we run into the following runtime error:

[plugin:@tailwindcss/vite:generate:serve] Package path . is not exported from package /Users/philipp/dev/tailwindcss/playgrounds/vite/node_modules/@headlessui/tailwindcss (see exports field in /Users/philipp/dev/tailwindcss/playgrounds/vite/node_modules/@headlessui/tailwindcss/package.json)

I think this is caused by unexpected content in the exports map. This changes the contents to be similar to what we do for the tailwindcss package.

Copy link

vercel bot commented Oct 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 0:36am
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 0:36am

@philipp-spiess
Copy link
Member Author

Wait this doesn't work, let me tinker

@philipp-spiess
Copy link
Member Author

Ok this works now 😅

Tested on our two playgrounds:

  • Vite (for ESM)
  • Next.js 14 (via postcss for CJS)

@@ -17,7 +17,8 @@
"require": "./dist/index.d.cts"
},
"import": "./dist/headlessui.esm.js",
"require": "./dist/index.cjs"
"require": "./dist/index.cjs",
"default": "./dist/headlessui.esm.js"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems weird that it'd be necessary 🤔

Shouldn't this be used via @plugin in v4 anyway? Not @import "…"? There's not a CSS file here so…

@philipp-spiess
Copy link
Member Author

This needs to be fixed in our enhanced resolver config

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

Successfully merging this pull request may close these issues.

2 participants