Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts-loader executing files not in Webpack Dependency Graph #656

Closed
awlui opened this issue Oct 17, 2017 · 3 comments
Closed

ts-loader executing files not in Webpack Dependency Graph #656

awlui opened this issue Oct 17, 2017 · 3 comments

Comments

@awlui
Copy link

awlui commented Oct 17, 2017

From my understanding, the dependency graph generated by Webpack will only contain files imported through the entry file. Other files aren't inspected. However, when I build a Typescript project with webpack/ts-loader, files, and files in subdirectories, in the same folder as the entry file are being inspected by the build process even though they aren't imported anywhere.

Say for example, I have a typical webpack/typescript project. In the src folder, alongside entry.ts, I place a notInDependencyGraph.ts file with just some gibberish like 'ajlkajdflkajsdlf', which is not imported anywhere.
Webpack outputs:
ERROR in ~/test/src/scripts/notInDependencyGraph.ts
(1,1): error TS2304: Cannot find name ajlkajdflkajsdlf

Now when dealing with babel-loader in the past, webpack wouldn't even touch that file. Is this just a consequence of ts-loader, though awesome-typescript-loader has the same issue, or is it a consequence of my misunderstanding of Webpack's inner workings, which is indeed shallow.

@johnnyreilly
Copy link
Member

Closing as duplicate of #267

Essentially this is intended behaviour but we're open to PRs that introduce alternative behaviour that will be opt-in only (i.e. users would need to specify a ts-loader option to trigger this behaviour)

@awlui
Copy link
Author

awlui commented Oct 17, 2017

Ah my apologies, didn't spot it in my initial search.

@johnnyreilly
Copy link
Member

No worries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants