Skip to content

Conversation

@FluxKraken
Copy link

Problem

Import Statements in src/*.ts files were missing ".js" extensions resulting in a module not found error when using ESM imports.

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/css-variants/dist/esm/cx'

Changes Made

Added required .js extensions to src/*.ts import statements.

Tests Run

  • yarn build
  • yarn test

@vercel
Copy link

vercel bot commented Dec 14, 2025

@FluxKraken is attempting to deploy a commit to the Tim Phan's projects Team on Vercel.

A member of the Team first needs to authorize it.

@timphandev
Copy link
Owner

Thanks for identifying this issue! You're right that the ESM build had module resolution problems. Instead of adding .js extensions to all imports, I've migrated the build system to tsup which handles this automatically. The fix is now in main (v2.3.0) and includes:

  • Native ESM support with "type": "module"
  • Proper dual CJS/ESM builds
  • Subpath exports (css-variants/cv, css-variants/cx, etc.)

This approach is cleaner as it doesn't require modifying source files and provides better bundling overall. Closing this PR as the issue has been resolved differently. Thanks again for the report!

@timphandev timphandev closed this Dec 14, 2025
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