electron-userland / electron-userland/electron-webpack

Spread operator not working as expected

Open
#65 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
902
Forks
168
PR merge metrics
No merged PRs in 30d

Description

I can run and use the spread operator like this, anywhere without issue.

```js
let thing = ...[1,2,3]
let thang = [...thing, 'word']
```

But, using this as recommended by the [vuex docs](https://vuex.vuejs.org/en/getters.html) something like this

```js
export default {
import { mapGetters } from 'vuex'

computed: {
...mapGetters([
campaigns
]),
}
}
```
...will make webpack fail...
```
ERROR in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/renderer/campaigns/index.vue
Module build failed: SyntaxError: Unexpected token (103:4)

101 |
102 | computed: {
> 103 | ...mapGetters([
| ^
104 | campaigns
105 | ]),
106 | // testy: function() {
```

I'm not certain where the problem lies. Clearly the `vue-loader ` is capable of handling the spread syntax... Maybe it's a different implementation of spread?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.