简体   繁体   中英

exports is not defined within Hybrid angular app

I am working over Angularjs and angular 6 integration with in a hybrid app.

tsconfig.json

    {
  "compilerOptions": {
    "target": "es5",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es2015", "dom" ],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  }
}

However, I am getting below error at my app.module.js file

exports is not defined in app.module.js at
Object.defineProperty(exports, "__esModule", { value: true });

I have removed commonjs from tsconfig. Still ther above error is coming up.

It is also giving a redline over "lib": [ "es2015", "dom" ] Not sure why? Pls guide.

With angular 6, the tsconfig.json file generated by angular itself is:

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

Try with above code, hope it will resolve your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM