0

I'm trying to import classes from a .js file, but when I run the program it seems to have a Syntax error. Here's my code:

import { RTUser, RTEvent, RTPurchase, RTMedia } from "./defs";

and here's the error that's being shown in the console.

/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)

An example of an export in the defs.js file is:

export class RTPurchase extends RTClass { }

The files are built from .ts files using tsc.

Any help would be appreciated!

William
  • 81
  • 1
  • 9

1 Answers1

0

Try Using var esLint = require('./ejbs');

Tayyab Mehar
  • 321
  • 3
  • 7