TypeStrong/ts-loader

Add typescript files into webpack fileDependencies in transpileOnly mode?

MQuy opened this issue · 4 comments

MQuy commented

I am not sure this is the right place to ask this question. I will demonstrate with the example below

# demo.ts
export interface Demo {
  [key: string]: string
}
....
# index.ts
import { Demo } from './demo'

const demo: Demo = { "hello": "ts-loader" };

in my ts-loader config, if I don't enable transpileOnly, demo.ts file will be included in webpack fileDependencies (I assume it is from this part https://github.com/TypeStrong/ts-loader/blob/master/src/index.ts#L302), but if I enable transpileOnly, demo.ts won't be include in my webpack fileDependencies

I wonder is there an way that I can enable transpileOnly and demo.ts is still in webpack fileDependencies?

I'm pretty sure the answer is "no". I think you've already noticed but there's essentially 2 modes of operation for ts-loader. transpileOnly or not. transpileOnly doesn't register file dependencies. I'm not sure if it can anyway because of the exposed API it is using. Do feel free to have a play and report back!

MQuy commented

thanks, I actually played around with ts-loader but cannot find a way to make it work :(

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale commented

Closing as stale. Please reopen if you'd like to work on this further.