x-tag / core

The Heart of X-Tag
http://x-tag.github.io/
Other
1.25k stars 151 forks source link

Cannot assign to read only property 'currentTarget' of object '#<MouseEvent>' #171

Open WeijianXu opened 7 years ago

WeijianXu commented 7 years ago

I got this error message when I used webpack2 to pack my code include x-tag. The detail is: return i.stack = function(e) { e.currentTarget = e.currentTarget || this; var t = e.detail || {}; return t.__stack__ ? t.__stack__ == a ? (e.stopPropagation(), e.cancelBubble = !0, a.apply(this, arguments)) : void 0 : a.apply(this, arguments) } this line e.currentTarget = e.currentTarget || this; throwed this error. why cann't it assign to read? My package.json: "devDependencies": { "extract-text-webpack-plugin": "^2.1.0", "html-webpack-plugin": "^2.28.0", "webpack": "^2.2.1", "webpack-livereload-plugin": "^0.10.0" }

WeijianXu commented 7 years ago

when I modified the code e.currentTarget = e.currentTarget || this; to this: if (!e.currentTarget) { e.currentTarget = this; }. It worked well.

johnsto commented 7 years ago

FYI I'm encountering this error with similar code using Rollup.js w/Babel, so it's not Webpack-specific.