ReferenceError using url package

Hey,
importing and using URL with require did not work for me, but I found a workaround:

try the following to add some query paramters to a url:

const sdk = require('postman-collection');
let myUrl = new sdk.Url('https://https://accounts.eu1.gigya.com/accounts.getJWT');
myUrl.query.add({"targetUID":pm.environment.get("sap_cdc_target_uid")});
myUrl.query.add({"apiKey":pm.environment.get("sap_cdc_target_uid")});
myUrl.query.add({"userKey":pm.environment.get("sap_user_key")});

This will add Query Paramters to the query property of type (PropertyList) PropertyList - Postman Documentation

You can also access query string by index

myUrl.query.idx(0).value = "newValue";

Credits to: How can we parse a URL in a pre-request script? · Issue #3059 · postmanlabs/postman-app-support · GitHub
Documentation: Url - Postman Documentation