Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to use an installed public package in Dataform?

I installed this package in dataform successfully
https://www.npmjs.com/package/libphonenumber-js

This is how it looks the package.json

{
  "name": "vx_operation",
  "dependencies": {
    "@dataform/core": "3.0.2",
    "libphonenumber-js":"1.11.7"
  }
}

This is how it looks the require statement. And I'm getting the error "Unexpected token 'export'"

tomlag_0-1725015144679.png

Do you know what could be?

I searched the dataform documentation several times, including the googlecloudcommunity and youtube. I didn't find examples of installing external libraries. 

Thanks

Solved Solved
0 4 391
1 ACCEPTED SOLUTION

This is a "module" type package (ES) which requires to async. 
I changed the package to google-libphonenumber and now is working fine to require the package in the standard way that dataform needs.

View solution in original post

4 REPLIES 4