Reputation: 9678
Say I have the following:
import validator from 'validator'
and in my code do:
validator.isEmail(txt)
Would that import the entire validator
and increase the overall package size?
if, how do I avoid this?
Upvotes: 1
Views: 78
Reputation: 1354
Your statement will import the whole validator. What are you looking for is this
import { isEmail } from ‘validator’
isEmail should be e exported in the source file.
Upvotes: 3