frankwallis/plugin-typescript

should support TS, TSX, JS, JSX in same directory

mavericken opened this issue · 2 comments

Currently plugin-typescript can only handle one file extension per directory via SystemJS's default extension configuration. The typescript compiler, on the other hand, will try multiple extensions until it finds the file. I feel that plugin-typescript's capabilities should match the capabilities of the standard typescript compiler, so we should also check for other extensions when we fail to find the file.

I have made a pull request that can do what I am proposing: #172

My solution was helpful, but after using it this afternoon I found it to be incomplete, so I closed the pull request. Nonetheless I think the issue is still valid.

Edit: I made some improvements and made a new pull request: #176
It provides a configurable way to fall back to other file extensions if the one attempted is not resolvable. So you can add the option fileExtensions: ["ts","tsx"], and if you ask it for filename.ts, and it does not exist, but filename.tsx exists, it will grab filename.tsx. This way you can have both file types in a single directory, like with the normal typescript compiler.

I made a separate module which will take care of this, which can be used in conjunction with plugin-typescript.
https://www.npmjs.com/package/one-plugin