Hi i tried you package but somehow we cannot get the constructor running in node env.
Closed this issue · 2 comments
Node script: using v12.9.1
`
const PostalAddress = require('i18n-postal-address')
//import PostalAddress from 'i18n-postal-address'
const myAddressPersonal = new PostalAddress()
myAddressPersonal
.setAddress1('Rua do Pastel, 19')
.setCity('Aveiro')
.setCountry('Brazil')
.setFirstName('John')
.setHonorific('Mr.')
.setLastName('Pestana')
.setPostalCode('2700-242')
.setSecondName('Lopes')
.setOutputFormat('array')
.setFormat({
country: 'NO',
type: 'personal',
})
`
Outputs:
const myAddressPersonal = new PostalAddress()
TypeError: PostalAddress is not a constructor
Any idea what I'm doing wrong here? The web based version seems to work really well..
@jonnyhoeven , could you try importing using the default
key?
const PostalAddress = require('i18n-postal-address').default
/*
...rest of the code
*/
Ah .default Thanks a lot!