Open Alex-Sokolov opened 5 years ago
I have the same: Please make a work around for IE11
[Vue warn]: Error in created hook: "TypeError: Object.seal: argument is not an Object"
"vue": "^2.5.17", "vue-native-websocket": "^2.0.9", "@vue/cli-plugin-babel": "^3.0.1", "@vue/cli-plugin-eslint": "^3.0.1", "@vue/cli-plugin-unit-jest": "^3.0.1", "@vue/cli-service": "^3.0.1",
放弃这个插件吧,ie11g等不支持Proxy的逻辑作者没有实现好,无法使用
This is not a solution and this bug should not be marked as "fixed" this is a work around/hack to make the application not crash into a ditch if using IE11:
Only mount the plugin if modern browser
In your main.js file:
import VueNativeSock from 'vue-native-websocket'
if (!(window.ActiveXObject) && 'ActiveXObject' in window) {
store.dispatch('app/setModernBrowser', false)
} else {
Vue.use(VueNativeSock, wsUrl(), {
store: store,
connectManually: true,
format: 'json'
})
store.dispatch('app/setModernBrowser', true)
}
@larsmars this guy made it work without using Proxy object. Tested it and it works properly. https://www.npmjs.com/package/vue-native-websocket-es5
@larsmars this guy made it work without using Proxy object. Tested it and it works properly. https://www.npmjs.com/package/vue-native-websocket-es5
What did he do? That package ref. to this repo. Will it work properly on IE11?
I've fixed the same error with @babel/polyfill
Now in build (https://raw.githubusercontent.com/nathantsoi/vue-native-websocket/master/dist/build.js) there is
Object.seal(this.$options.sockets)
usingIE11 doesn't know what it is & will throw error. I think need to include polyfill for Object.seal or mention about it in readme
I think it's because the this.$options.sockets
is not the object (i think it's undefined
) and IE11 follows to ES5 code:
Now in build (https://raw.githubusercontent.com/nathantsoi/vue-native-websocket/master/dist/build.js) there is
Object.seal(this.$options.sockets)
usingIE11 doesn't know what it is & will throw error. I think need to include polyfill for Object.seal or mention about it in readme