在Ionic应用程序中,我试图在TS文件中调用外部JS文件的函数并收到此错误:(第9行是labelImage = function(){
)
Error: Uncaught (in promise): Error: Module parse failed: Unexpected token (9:15)
You may need an appropriate loader to handle this file type.
|
| export class CloudVision{
| labelImage = function(){
| // Creates a client
| const client = new vision.ImageAnnotatorClient();
我在TS文件的开头导入了这个JS文件:
import { CloudVision } from '../../../vision.js'
并将其用于:
CloudVision.labelImage()
答案 0 :(得分:-1)
试试这个
import * from '../../../vision.js
或将其包含在ionic-li中
或在typings中查找类型定义