반응형
Object.assign 없이 mapActions 오류 사용?
x.vue 파일
methods: {
...mapActions([
'fetchTopicVideo',
]),
}
에러가 발생하며 에러 정보는 다음과 같다.
ERROR in ./~/buble-loader!./~/vue-loader/lib/selector.js?
type=script&index=0!./src/components/CardList.vue
Module build failed:
43 : // }, (res) => {
44 : // console.log('query error')
45 : // })
46 : },
47 : methods: {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Object spread operator requires specified objectAssign option with 'Object.assign' or polyfill helper. (47:11)
@ ./src/components/CardList.vue 7:2-105
@ ./~/buble-loader!./~/vue-loader/lib/selector.js?type=script&index=0!./src/views/ClientTopicShare.vue
@ ./src/views/ClientTopicShare.vue
@ ./src/router/index.js
@ ./src/app.js
@ ./src/client-entry.js
@ multi webpack-hot-middleware/client ./src/client-entry.js
그러나 아래 코드는 오류를 발생시키지 않을 것이다:
methods: Object.assign({},
mapActions([
'fetchTopicVideo'
])
)
.babelrc 파일:
{
"presets": ["es2015", "stage-2"],
"plugins": ["transform-runtime"],
"comments": false
}
개코원숭이가 실패해서 이러는 걸지도 몰라
이 문제는 https://github.com/vuejs/vue-hackernews-2.0/issues/87에 의해 해결되었다.
버블 설치, vue-loader.config.js 편집
module.exports = {
...
buble: {
objectAssign: 'Object.assign',
},
}
참조URL: https://stackoverflow.com/questions/42552636/using-mapactions-error-without-object-assign
반응형
'IT이야기' 카테고리의 다른 글
돌연변이를 통해 상태 속성을 동적으로 추가하는 방법 (0) | 2022.05.05 |
---|---|
소방 기지:페이스북AuthProvider가 생성자가 아님 (0) | 2022.05.05 |
데이터 변수에서 Vue-stash 반응성이 작동하지 않음 (0) | 2022.05.05 |
Nuxt 및 Jest를 사용한 Vuex 스토어 테스트에서 이.app 및/또는 주입된 플러그인에 액세스하는 방법 (0) | 2022.05.05 |
파일을 만들고 쓰려면 어떻게 해야 하는가? (0) | 2022.05.04 |