6

If I import a file import * as test from './dir/file', the .js extension is missing in the build

I want the output file like this import * as test from './dir/file.js'

The problem is: YES I can add the .js manually BUT many libraries doesn't have the .js extension manually added, and I don't want to go through all files of a library and add the extension manually.

And I know there are some regex replacer out there which add the .js extension. But is this the only way?? Is there no way to tell TypeScript to add the .js (maybe via tsconfig.json)???

1

1 Answer 1

5

There is a github issue opened about this, check it out here for workarounds, as I don't think it is possible with current ts compiler.

Sign up to request clarification or add additional context in comments.

1 Comment

Another potential workaround: github.com/olalonde/tsc-module-loader

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.