Uncaught ReferenceError: exports is not defined and require

后端 未结 3 1991
一向
一向 2021-01-12 03:36

I\'m using angularjs and typescript to create some app, I\'m having a trouble with this error that I can\'t solve

Here is my *.ts code

export var NgA         


        
3条回答
  •  走了就别回头了
    2021-01-12 03:58

    click here "Solved finally" i was also getting same error i changed module:"commonjs" to "module": "es6", because targeting ES5 remove the import/export statements, so these tools cannot remove unused exports.

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

提交回复
热议问题