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
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
Most helpful comment
instead of
should do the trick here.
The
es/index.jsfile already has an default export namedvalidator.Works fine for me.
@profnandaa @Maxreglez