s-panferov / awesome-typescript-loader

Awesome TypeScript loader for webpack
Other
2.35k stars 179 forks source link

fix: Changed declaration generation to generate .d.ts files for all f… #590

Closed bkrupa-argo closed 6 years ago

bkrupa-argo commented 6 years ago

…les, including those that produce no javascript

This fix addresses issues mentioned in

The reason this issue is occurring is that adding a dependency to the loader does not guarantee that the loader will be run for the file that was added. The dependencies that are added are only added to the fileDependencies property in the loader, so webpack only cares about them from a watch standpoint.

Dependencies that need to be run by the loader are computed from the output of the acorn compiler. In this case, since there is no actual source code generated from the interface file, the compiler generates no dependencies and doesn't run the loader on the file.

I have created a sample repository here: https://github.com/bkrupa-argo/atl-interface-webpack4-repro

Additionally, I have another branch that fixes the issue in webpack 3 (as that is the version I am currently working in). Would you like me to contribute that change back as well?

adamdoyle commented 6 years ago

What happened to this PR? Were there issues with the fix?

bkrupa-argo commented 6 years ago

@adamdoyle The fix should work in its current state.