我正在尝试运行需要两个第三方库的自定义函数。我将库添加到库的窗格中,如下所示:
@tensorflow/tfjs@1.5.1
@tensorflow/tfjs-node@1.4.0
sentence-tokenization@1.0.2
我收到这些错误:
{
"error": [
"ReferenceError: Can't find variable: exports",
"https://unpkg.com/@tensorflow/tfjs-node@1.4.0/dist/index.js",
32,
30,
{
"message": "Can't find variable: exports",
"line": 32,
"column": 30,
"sourceURL": "https://unpkg.com/@tensorflow/tfjs-node@1.4.0/dist/index.js",
"stack": "global code@https://unpkg.com/@tensorflow/tfjs-node@1.4.0/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/sentence-tokenization@1.0.2/tokenizers.js",
1,
19,
{
"message": "Can't find variable: require",
"line": 1,
"column": 19,
"sourceURL": "https://unpkg.com/sentence-tokenization@1.0.2/tokenizers.js",
"stack": "global code@https://unpkg.com/sentence-tokenization@1.0.2/tokenizers.js:1:19"
}
]
}
自定义函数的代码也抱怨需要,但我能够用这个解决它。
declare var require: any;
我在这里找到了建议,但不确定如何让它与库一起使用。
我错过了什么?
提前致谢。