Search code examples
webpack-5

Webpack 5 runtime and dependOn property


I'm mostly confused as to what the runtime property is actually doing for a webpack entry point. Referenced here:

enter image description here

And even more confused when the documentation makes this statement:

enter image description here

What exactly is the runtime chunk for an entry point and how does it relate to that limitation.

Ty!

Link to full page here


Solution

  • By default, each entry point will have an embedded runtime. The runtime can be think of as an mechanism to record the module import/export record, so you won't have duplications of module initialization. By specifying runtime you're telling webpack to create-or-reuse a runtime. On the other hand, with dependOn you can reuse a runtime by specifying an existing entry name. Since these two ideas overlap, so you probably won't want to do it at the same time.