Thanks so much for this simple example!
It really revealed the 'magic' behind javascript bundler for me.
There is a point I'm not quite understand though.
Regarding the for .. of loop in the createGraph function
|
// only has one asset but as we iterate it we will push additional new assets |
|
// into the queue. This loop will terminate when the queue is empty. |
|
for (const asset of queue) { |
To my understanding, the loop will terminate when
- there are no more
child asset being pushed to the end of query
- the code reached the end of
query
which also means the the dependency graph was completed.
Hence the query will never be empty (there is at least one asset: the entry/main asset)
Or did I misunderstand something here?
Thanks so much for this simple example!
It really revealed the 'magic' behind javascript bundler for me.
There is a point I'm not quite understand though.
Regarding the
for .. ofloop in thecreateGraphfunctionminipack/src/minipack.js
Lines 115 to 117 in ce3b1b5
To my understanding, the loop will terminate when
childasset being pushed to the end ofqueryquerywhich also means the the dependency graph was completed.
Hence the
querywill never be empty (there is at least one asset: the entry/main asset)Or did I misunderstand something here?