Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Jme797
Copy link

@Jme797 Jme797 commented Sep 17, 2025

Fixes: #2587

Modifies the exports inside index.js so that instead of importing all the code into the file and exporting it as a single object it just exports the functions directly.

This comes with the caveat you can no longer import * like import validator from 'validator' in esm modules because that prevents codesplitting.

If you really want to for whatever reason you can replace that syntax with import * as validator from 'validator'

Though importing specific functions is more efficient using imports like import {isEmail} from 'validator'

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

Copy link

codecov bot commented Sep 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6f436be) to head (de9b0c7).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2588   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       115    +1     
  Lines         2536      2535    -1     
  Branches       642       643    +1     
=========================================
- Hits          2536      2535    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Importing all validation functions into index.js prevents successful treeshaking.
1 participant