Typescript configuration to use modules

I am using typescript for this application, I can’t get it to work with modules though. At first I tried with the simple packages installed through npm but I can’t work with local modules either, I tried to import both using .js and .ts extension.
I’m given this error in the browser:

Uncaught ReferenceError: exports is not defined

My .tsconfig is:

"target": "es2016",
 "outDir": "./src/js",
 "rootDir": "./src/ts",
"module": "commonjs", 
"moduleResolution": "node10", // this one I tried to add to resolve the problem
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true

One of the most common solutions, beside changing the .tsconfig file in ways I already did, is to add a exports variable in the script but then I get:

Uncaught ReferenceError: require is not defined

The only thing that seems to work is using parcel to bundle the code, but I’d rather work without bundling every change I make