Validator.js: validator does not provide an export named 'default'

Created on 10 Dec 2019  路  3Comments  路  Source: validatorjs/validator.js

I use the validator in my TypeScript project. That works and everything is fine.
But then I want to test my project with karma and got this error message SyntaxError: The requested module '../../../../../../node_modules/validator/index.js' does not provide an export named 'default' Is there anything I could do or is it a mistake?

i imported it like this
import validator from "validator";
Version of validator is 12.1.0
Karma Version 4.4.1

help wanted 馃悰 bug 馃攳needs-investigation

Most helpful comment

import validator from 'validator/es';

instead of

import validator from 'validator';

should do the trick here.
The es/index.js file already has an default export named validator.

Works fine for me.
@profnandaa @Maxreglez

All 3 comments

PR is welcome!

import validator from 'validator/es';

instead of

import validator from 'validator';

should do the trick here.
The es/index.js file already has an default export named validator.

Works fine for me.
@profnandaa @Maxreglez

I use

typescript import * as validator from "validator";

https://github.com/microsoft/TypeScript/issues/3337#issuecomment-107971371

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zilahir picture zilahir  路  3Comments

rathboma picture rathboma  路  4Comments

woverton picture woverton  路  4Comments

mfbx9da4 picture mfbx9da4  路  4Comments

IOAyman picture IOAyman  路  4Comments