-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Documentation Issue: Incorrect ES Import Path #2528
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
Comments
If I'm looking through the published files in NPM, I do see that file. It's not in the repo since it's generated upon preparing a release. |
Noting the error messages received when using ES import syntax from the documentation. To reproduce: Node 22.x, NPM 10.x, validator: 13.15.0, package.json.type: module.
//import isEmail from 'validator/es/lib/isEmail'; // Documentation example 2. Throws error snippet below. import isEmail from 'validator/lib/isEmail.js'; // Refactor with js extension. Works. // import isEmail from 'validator/es/lib/isEmail.js'; // Refactor 2 with js extension. Throws error snippet below. console.log(isEmail('example@example.com'));` |
I can confirm the same behavior and will add that I get some sort of error no matter how I import the library unless I use the ES6 default import style ( |
The documentation on npm indicates that tree-shakeable ES imports should be done using:
import isEmail from 'validator/es/lib/isEmail.js'
. However, the es folder does not exist in the package. Only the path validator/lib/isEmail.js works.Either the es folder should exist to support ES imports as documented, or the documentation should be updated to reflect the correct import path (
validator/lib/isEmail.js
).The text was updated successfully, but these errors were encountered: