How it works...

The es2015 Babel preset is a collection of Babel plugins that aims to transform ECMAScript2015 (ES6) syntax into simpler JavaScript. For example, it contains the babel-plugin-transform-es2015-arrow-functions plugin, which as you may have guessed, transforms arrow functions:

var addOne = n => n + 1

Transform the arrow functions into simpler JavaScript as follows:

var addOne = function addOne(n) {  return n + 1}

To select the files and their respective loaders, we filled the test field inside webpack.config.js and to match the .vue files, we wrote the following:

test: /\.vue$/

This syntax is a regular expression and it always starts with a forward slash and ends with another forward slash. The first character it matches ...

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.