我正在尝试构建一个Angular2项目,使用Web Midi API。
运行ng build
时,由于抛出了某些错误,我无法完成该过程,具体来说:
Error in bail mode: [default] /Users/JmsToh/GitHub/web-editor/web-editor/src/app/midi.service.ts:43:22 Property 'requestMIDIAccess' does not exist on type 'Navigator'.
这是代码的以下部分引起的:
if (navigator.requestMIDIAccess) {
this.browserMidiCompatible = true;
navigator.requestMIDIAccess({ sysex: false })
.then(this.onMIDISuccess.bind(this), this.onMIDIReject.bind(this));
} else {
alert("Platform not compatible");
}
在运行ng serve
时,这个应用程序在Chrome上运行良好。是否有任何方式可以让Angular2在构建时忽略错误?
tsconfig.app.json
中。 - runit