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

Transpile import.meta.url in config files #13322

Merged
merged 3 commits into from Mar 22, 2024

Conversation

thecrypticace
Copy link
Contributor

Right now if you try to use import.meta.url in a tailwind.config.js file (or a dependency) Node will throw an error. This happens because config files are compiled to Common JS internally using Jiti and Sucrase. However, Sucrase doesn't rewrite import.meta.url so we must use Jiti's built-in Babel transform in this case.

Fixes tailwindlabs/tailwindcss-intellisense#909

Copy link
Contributor

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

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

Looks good, only thing remaining is probably a changelog fixed entry.

@thecrypticace
Copy link
Contributor Author

Ah yeah will do! I'm testing the Standalone CLI to verify it works there too.

@thecrypticace thecrypticace changed the title Use Babel to transpile configs when import.meta is present Transpile import.meta.url in config files Mar 22, 2024
@thecrypticace thecrypticace merged commit b10b431 into master Mar 22, 2024
13 checks passed
@thecrypticace thecrypticace deleted the fix/import-meta-in-config branch March 22, 2024 16:45
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.

Doesn't work with ES Module syntax
2 participants