0

I'm trying to run a custom function that requires two third-party libraries. I added the libraries to the libraries' pane like this:

@tensorflow/[email protected]

@tensorflow/[email protected]

[email protected]


I get these errors:

{
    "error": [
        "ReferenceError: Can't find variable: exports",
        "https://unpkg.com/@tensorflow/[email protected]/dist/index.js",
        32,
        30,
        {
            "message": "Can't find variable: exports",
            "line": 32,
            "column": 30,
            "sourceURL": "https://unpkg.com/@tensorflow/[email protected]/dist/index.js",
            "stack": "global code@https://unpkg.com/@tensorflow/[email protected]/dist/index.js:32:30"
        }
    ]
}

{
    "error": [
        "ReferenceError: Can't find variable: require",
        "https://script-lab-runner.azureedge.net/",
        38,
        17,
        {
            "message": "Can't find variable: require",
            "line": 38,
            "column": 17,
            "sourceURL": "https://script-lab-runner.azureedge.net/",
            "stack": "global code@https://script-lab-runner.azureedge.net/:38:17"
        }
    ]
}

{
    "error": [
        "ReferenceError: Can't find variable: require",
        "https://unpkg.com/[email protected]/tokenizers.js",
        1,
        19,
        {
            "message": "Can't find variable: require",
            "line": 1,
            "column": 19,
            "sourceURL": "https://unpkg.com/[email protected]/tokenizers.js",
            "stack": "global code@https://unpkg.com/[email protected]/tokenizers.js:1:19"
        }
    ]
}

The code for the custom function also complains about require, but I was able to resolve it with this.

declare var require: any;

I found the suggestion here but not sure how to get this to work with the libraries.

What am I missing?

Thanks in advance.

Rick Kirkham
  • 9,038
  • 1
  • 14
  • 32

0 Answers0