laravel-enso / enso

Laravel Vue SPA, Bulma themed. For demo login use `admin@laravel-enso.com` & `password` -
https://www.laravel-enso.com
MIT License
1.08k stars 277 forks source link

3.3: es6 support changed? #232

Closed jlsjonas closed 5 years ago

jlsjonas commented 5 years ago

This is a bug | question.

Prerequisites

3.3 upgrade

Description

Quite obscure...was anything changed to ES6 support? I moved my (laravel-websockets-related) patch from IO/Notifications.vue to the new websockets.js, however webpack seems to error on the es6 destructuring that's happening there.

Apologies if not related to Enso itself

 WARNING  Compiled with 1 warnings                                                                                            09:45:07

 warning  in ./node_modules/@enso-ui/ui/src/modules/store/websockets.js

Module parse failed: Unexpected token (21:16)
You may need an appropriate loader to handle this file type.
|                 key: state.pusher.key,
|                 cluster: state.pusher.cluster,
|                 ...state.pusher.options.host && {
|                     wsHost: state.pusher.options.host,
|                     httpHost: state.pusher.options.host,

 @ ./node_modules/@enso-ui/ui/src/modules/store nonrecursive .*\.js$
 @ ./node_modules/@enso-ui/ui/src/modules/store.js
 @ ./resources/js/store.js
 @ ./resources/js/enso.js
 @ multi (webpack)-dev-server/client?http://webtools.test:3030 webpack/hot/dev-server ./resources/js/enso.js ./resources/sass/enso.scss ./node_modules/@enso-ui/themes/bulma/light.scss ./node_modules/@enso-ui/themes/bulma/dark.scss ./resources/sass/print.scss

Steps to Reproduce

  1. Add a destructured object in node_modules/@enso-ui/ui/src/modules/store/websockets.js's new Echo
  2. yarn dev/hot

Expected behavior

compilation to succeed

Actual behavior

Parsing error, seemingly not being able to handle object destructuring (ES6) anymore

aocneanu commented 5 years ago

I was affected by this when I started @enso-ui.

https://github.com/JeffreyWay/laravel-mix/issues/1805

aocneanu commented 5 years ago

And by the way, I fixed it by refactoring the spread operator.

jlsjonas commented 5 years ago

🤔 interesting... The issue makes sense, but it wasn't an issue before... presumably as it was within a .Vue file and thus still required transpiling.

I fixed it by refactoring the spread operator.

You don't happen to have any code example? 😄

aocneanu commented 5 years ago

instead of doing return { ...obj, a: 5 } just obj[a] = 5; return obj

jlsjonas commented 5 years ago

I'll have to write mine with if's 😬 will make do thanks