When I run TodoAppUI.js:15, I get an error saying "Uncaught ReferenceError: exports is not defined"
In all my classes, I use the export
keyword.
For example:
export class mysclass {
public constructor(){}
}
Even though I have the proper syntax for importing, it still doesn't work
import TodoAppUI = require("./TodoAppUI");
This is how my configuration file looks like:
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"target": "es5"
},
"files": [
"TodoApp.ts",
"BaseService.ts",
"TodoAppUI.ts"
]
}
The following code snippet is the one causing the issue:
Object.defineProperty(exports, "__esModule", { value: true });