I am trying to create a simple PixiJS game using Typescript as the code base. I then compile the typescript to Javascript using "npx tsc" and finally in my html file I reference the newly created/updated javascript file from the typescript.
The error I get is "Uncaught ReferenceError: exports is not defined at index.js:25:23" after compiling typescript and trying to run the html in browser. Here's the Javascript code:
Object.defineProperty(exports, "__esModule", { value: true });
const PIXI = __importStar(require("pixi.js"));
let app;
let player; //PLAYER "NODE"
let game_hold;
window.onload = function () {
app = new PIXI.Application({
width: 900,
height: 700,
background: '#1099bb'
});
document.body.appendChild(app.view);
};
I have tried to define "exports", I've tried to clear all the other lines of code but I still get errors
This is the config.json file:
{
"compilerOptions": {
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"target": "ES2015",
"noImplicitAny": false,
"sourceMap": true,
"outDir": "src"
},
"exclude": [ "node_modules" ],
"include": ["src"]
}