(Fixed) Node.js ESM issue
Prerequisites:
- Either add
type: "module"
flag in the application'spackage.json
file. - Or write the application's code in an
.mjs
file.
Then the following code won't work — none of the "named exports" would be found:
import {
isPossiblePhoneNumber,
isValidPhoneNumber
} from 'libphonenumber-js';
Reproduced on Node 14+.
Edited by Nikolay Kuchumov