Skip to content

fix ES Module syntax #2267

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

Closed
wants to merge 1 commit into from
Closed

fix ES Module syntax #2267

wants to merge 1 commit into from

Conversation

vloum
Copy link

@vloum vloum commented Apr 17, 2025

Fix: Convert tailwind.config.js to ES Module syntax

Problem

When running pnpm build, Node.js throws a warning about loading ES Module in require() context. This is because the project is configured to use ES Modules (package.json has "type": "module"), but tailwind.config.js was using CommonJS syntax (module.exports).

Error Example

(node:22748) ExperimentalWarning: CommonJS module /Users/vlou/apps/MinerU/projects/web/node_modules/.pnpm/[email protected]/node_modules/tailwindcss/lib/lib/load-config.js is loading ES Module /Users/vlou/apps/MinerU/projects/web/tailwind.config.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time

file:///Users/vlou/apps/MinerU/projects/web/tailwind.config.js:1
module.exports = {
^

ReferenceError: module is not defined

Solution

Convert tailwind.config.js from CommonJS to ES Module syntax by:

  • Replacing module.exports with export default
  • Keeping all other configurations unchanged

Testing

  • Run pnpm build to verify the warning is resolved
  • Ensure all Tailwind CSS functionality works as expected

Related Context

  • Project uses Vite with ES Module configuration
  • Node.js version: v23.2.0
  • Tailwind CSS version: ^3.4.10

Impact

This change ensures consistent module syntax across the project and resolves the Node.js warning during build.

Copy link
Contributor

github-actions bot commented Apr 17, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@vloum
Copy link
Author

vloum commented Apr 17, 2025

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 17, 2025
@vloum vloum closed this Apr 21, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant