25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Loaders<br />

Part of what makes Webpack so powerful is that during the bundling process it<br />

can transform a module with one or more Webpack loaders.<br />

For example, Babel is a compiler that transforms next-generation JavaScript<br />

syntax such as ES2015 into st<strong>and</strong>ard ES5. The Webpack Babel loader is one of<br />

the most popular as it allows developers to write their code using modern<br />

features, but still provide support in older browsers.<br />

For example, in the entry file, we see the ES2015 const declaration that isn't<br />

supported by IE10.<br />

resources/assets/<strong>js</strong>/app.<strong>js</strong>: const app = new <strong>Vue</strong>({ el: '#app' });<br />

If the Babel loader is used, const will be transformed to var before it's added to<br />

the bundle.<br />

public/<strong>js</strong>/app.<strong>js</strong>: var app = new <strong>Vue</strong>({ el: '#app' });

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!