Undefined value of webRoot member of Package class

When a package defines the constructor, the value of member ‘webRoot’ becomes ‘undefined’ at runtime. Without any constructor, correctly returns the URL.

class SomePackage extends DG.Package {

constructor() { super(); }

startApp() {
 let url = this.webRoot; //becomes 'undefined' when constructor is defined


Welcome to our community!

You should override DG.Package constructor like this:

constructor(webRoot) {

By the way, there is another way of package definition, you can take a look at our NPM packages concept: https://datagrok.ai/help/develop/develop#buildable-packages