我最近注意到 V8 引擎的一个奇怪的行为。继承分离文件中的类时,引擎无法识别基类,例如以下配置失败:
基脚
export class BaseFoo {}
Run Code Online (Sandbox Code Playgroud)
特殊脚
import { BaseFoo } from "./BaseFoo";
class SpecialFoo extends BaseFoo {}
Run Code Online (Sandbox Code Playgroud)
有错误:
ReferenceError: BaseFoo 未定义 [行: 1, 函数: , 文件: SpecialFoo]
如果这两个类放在同一个文件中,它就可以工作。
我正在使用 Visual Studio Code,它批准了这个配置(意味着没有拼写错误)。
有任何想法吗?
最近我打开我的谷歌的幻灯片脚本运行时间从Rhino到V8。我测试了我的附加组件,但出现错误:
We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED.
我的脚本使用PropertiesService.getUserProperties(). 我发现我必须从我的 google 帐户注销并再次登录并且它起作用了。
我可以想象这对于使用此附加组件的其他用户来说也可能是痛苦的。有没有其他方法可以解决此错误?
appscript.json 配置
{
"timeZone": "Europe/Bratislava",
"runtimeVersion": "V8",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER"
}
Run Code Online (Sandbox Code Playgroud)
此外,我正在我的 PC nad 上开发本地附加组件,使用clasp将代码推送到 App 脚本。
我创建了最小的项目来重现这个错误,我发现这PropertiesService.getUserProperties()不是问题。事实证明,从Rhinoto切换后V8,我无法调用任何 appscript 函数。
// Code.gs
function onInstall(event) {
onOpen(event);
}
function onOpen(event) {
SlidesApp.getUi().createAddonMenu()
.addItem('Open the sidebar', '_showSidebar')
.addToUi();
_showSidebar();
}
function _showSidebar() { …Run Code Online (Sandbox Code Playgroud) v8 google-apps-script google-slides google-apps-script-addon google-apps-script-runtime