我正在尝试从.js文件导入类,但是当我运行该程序时,似乎出现了语法错误。这是我的代码:
import { RTUser, RTEvent, RTPurchase, RTMedia } from "./defs";
这是控制台中显示的错误。
/Users/williamg/retake/api/RTKit/index.js:34
import { RTUser, RTEvent, RTPurchase, RTMedia } from "./defs";
^
SyntaxError: Unexpected token {
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.wrappedLoad [as _load] (/Users/williamg/retake/api/node_modules/newrelic/lib/shimmer.js:372:38)
at Module.require (internal/modules/cjs/loader.js:637:17)
defs.js
文件中的导出示例如下:
export class RTPurchase extends RTClass { }
使用.ts
从tsc
个文件中构建文件。
任何帮助将不胜感激!
答案 0 :(得分:0)
尝试使用var esLint = require('./ ejbs');