Encountering an error message (Uncaught ReferenceError: exports is not defined) when attempting to import other TypeScript files in the main app.ts
app.ts
import { LanguagesConfigs } from './LanguagesConfigs';
let languagesConfigs = new LanguagesConfigs();
LanguagesConfigs.ts
export class LanguagesConfigs {
code
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true
}
}
Compiling in Visual Studio Code generates the .js and .js.map files.
Note: This project does not use frameworks like Angular, just plain TypeScript. Note2: CommonJS is installed in the project (Typescript ReferenceError: exports is not defined)