How it works...

In this recipe, we basically created a JavaScript file (bundle.js) that simultaneously contains Vue and the component we wrote. In the index.html, there is no trace of Vue because it's embedded in bundle.js.

This way of working is much better when we have a lot of dependencies. We don't need to add a lot of tags in the head or the body of the page anymore. Also, we don't have to be afraid to load a dependency that we don't need.

As an added bonus, Webpack has the power and flexibility to minify our final file and other advanced optimizations that are simply not possible by loading the dependencies manually.

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.