Skip to content Skip to sidebar Skip to footer

Understanding Webpack: Why Does It Add These Lines Of Javascript?

I'm learning Laravel and trying to understand how to use Laravel Mix to bundle assets (scss and javascript). As the documentation says: Laravel Mix provides a fluent API for defin

Solution 1:

If you have your school books, your calculator, your lunchbox and three granola bars, WebPack is what puts it all into one backpack so you can carry it easier. That code is the backpack. Even if you have nothing to put in it, it still makes a backpack.

Part of the reason for this is splitting up code that might interfere with each other if you had it in one namespace/scope. Having code in multiple files can create unintended interference if it isn't scoped right, and WebPack handles all of that using some of this code.

Yes, it compiles and minifies just like SCSS, but WebPack also adds more functionality that requires some boilerplate code.

Post a Comment for "Understanding Webpack: Why Does It Add These Lines Of Javascript?"