Is there a way to get dependency tree from webpack?
Asked Answered
S

1

9

I have a big project with different types of dependencies in it: js, scss, svg, png, etc... My webpack is configured and bundles my code, I am happy with it.

But I want to get some kind of hash of all my dependencies (including binaries and all files formats). And what is most important: I do not want to build my code during this. For this purpose I need, for example, array of all files inside all of entry points or at least some kind of dependencies tree.

I tried to use compilation hook finishModules, but it completes after the compilation. Also tried some other hooks of compiler, don't remember which exactly.

I tried to write loader, but it seems like by default there is only source code of high-level files (like entry points themselves).

I'd be happy to receive some direction to move with my problem.

Seto answered 24/12, 2018 at 14:21 Comment(4)
Why not utilize webpack stats? webpack.js.org/configuration/statsBonehead
Because it can be received only after build, and I don't want to build. I want to get information if something changed to make decision, run build or not.Seto
do you need to know when some file is changed as fs.watch() does?Ilka
No, I need to improve my deploy process like this: get some checksum of files, check if it changed (according to some saved checksum and bundles), and either run build or just get previously built bundles.Seto
S
11

Seems like I can solve my problem using https://github.com/pahen/madge

Seto answered 25/12, 2018 at 9:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.