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(module): replace require with ES module import for tailwind colors #3015

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kiansa
Copy link

@Kiansa Kiansa commented Jan 3, 2025

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR replaces the use of createRequire and require() with a direct ES module import for tailwindcss/colors.js. This change resolves compatibility issues when loading ES modules in Node.js and eliminates the experimental warning caused by using require().

ERROR  (node:33684) ExperimentalWarning: CommonJS module \.nuxt\nuxtui-tailwind.config.cjs is loading ES Module \node_modules\@nuxt\ui\dist\runtime\utils\colors.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Replaced the use of `createRequire` and `require()` with a direct ES module import for `tailwindcss/colors.js`

Should fix below error:

ERROR  (node:33684) ExperimentalWarning: CommonJS module ...\.nuxt\nuxtui-tailwind.config.cjs is loading ES Module ...\node_modules\@nuxt\ui\dist\runtime\utils\colors.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
@benjamincanac
Copy link
Member

@ineshbose Do we agree that this will be fixed upstream in @nuxtjs/tailwindcss already?

@benjamincanac
Copy link
Member

Mmmh, didn't you fix this in #2945 actually? πŸ€”

@ineshbose
Copy link
Member

I think this is a separate issue from tailwind specifically, it is the usage of require to generate colour shades for ui!

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.

3 participants