styopdev/webpack-interview-questions

Explain why OccurenceOrderPlugin

Closed this issue ยท 4 comments

Good q:

Why is OccourenceOrderPlugin a size optimization?๐Ÿ˜‰ It has to do with module ids and topological sorting.

Great, thanks

What about more formal version?

q: Why the OccurenceOrderPlugin is the part of webpack optimisation. What it has to do with module ids and topological sorting?

a: OccurenceOrderPlugin order the modules and chunks by occurrence. More module occurs - smaller id it has, this technique helps to reduce bundle size.

Exactlyyyyyyyyyyyy!!!! ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘

I might elaborate and say because a module is used many times it will be referenced many times with webpack_require(moduleId)

Added - 494b3d5