Try adding this to your package.json
"eslintConfig": {
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true,
"experimentalObjectRestSpread": true
},
"env": {
"es6": true,
"browser": true
}
}
}
and in your gulp file in your laravel-elixir instance check if there's a transformer named babelify in elixir.config.js.browserify.transformers
and if it exists push into its options.presets
a string stage-2
. Here's how I have it in my gulp file:
var elixir = require('laravel-elixir')
if (elixir.config.js.browserify.transformers[0].name === 'babelify') {
elixir.config.js.browserify.transformers[0].options.presets.push('stage-2');
}
It may differ for you but you get the idea. All this makes browserify compile the assets using the stage-2 features like the object spread operator that wouldn't normally be contemplated.