0

I have some typescript that looks like this:

import { Game } from './game'

And this transpiles into the following JavaScript:

import { Game } from './game'

(Note that there is no .js extension added by the transpiler)

My browser (Chrome) tries to load the file game rather than file game.js which causes a 404.

Is there a way to tell the typescript compiler to add the .js extension when generating the JavaScript?

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Darren
  • 722
  • 4
  • 12
  • FYI, I added the .js extension directly to the typescript and got it working, but it seems like a hack? – Darren Sep 18 '20 at 21:57
  • 1
    ok, found this. https://github.com/microsoft/TypeScript/issues/16577 lots of argument over whether this is even an issue. At least I have a work around. – Darren Sep 18 '20 at 22:09

0 Answers0