我正在将一个应用程序从angular.js (版本1)迁移到Vue.js版本2.4。
我正在从以开发模式提供原始Javascript文件转向使用Webpack、巴别塔和.vue,后者服务于处理后的Javascript文件。Webpack和Vue.js对我来说都是新的。
当代码中发生异常时,Vue.js或Webpack会截获该错误,并打印一个无用的堆栈跟踪。下面是一个例子。
我猜如果Vue.js/Webpack没有拦截异常,我可以在浏览器中看到堆栈跟踪以及发生异常的代码。
有没有在Vue.js中有效使用浏览器调试器的指南?
我使用的是Firefox,使用的是vuedevtools 2.5.9。
[Vue warn]: Error in created hook: "TypeError: not a function"
found in
---> <QueryBuilder> at src/components/querybuilder/QueryBuilder.vue
<Layout> at src/datamanager/Layout.vue
<QueryBuilderPage> at src/datamanager/QueryBuilderPage.vue
<App> at src/datamanager/App.vue
<Root> vue.esm.js:574
TypeError: not a function
Stack trace:
Promise@webpack-internal:///515:126:39
_rights@webpack-internal:///96:338:16
rights@webpack-internal:///96:461:16
created@webpack-internal:///304:241:9
callHook@webpack-internal:///2:2875:9
initMixin/Vue.prototype._init@webpack-internal:///2:4524:5
VueComponent@webpack-internal:///2:4694:7
createComponentInstanceForVnode@webpack-internal:///2:4208:10
init@webpack-internal:///2:4025:45
createComponent@webpack-internal:///2:5483:9
createElm@webpack-internal:///2:5431:9
createChildren@webpack-internal:///2:5554:9
createElm@webpack-internal:///2:5459:9
createChildren@webpack-internal:///2:5554:9
createElm@webpack-internal:///2:5459:9
createChildren@webpack-internal:///2:5554:9
createElm@webpack-internal:///2:5459:9
patch@webpack-internal:///2:5948:7
lifecycleMixin/Vue.prototype._update@webpack-internal:///2:2617:16
updateComponent@webpack-internal:///2:2745:7
get@webpack-internal:///2:3095:13
Watcher@webpack-internal:///2:3084:7
mountComponent@webpack-internal:///2:2752:3
Vue$3.prototype.$mount@webpack-internal:///2:8359:10
Vue$3.prototype.$mount@webpack-internal:///2:10699:10
init@webpack-internal:///2:4031:7
createComponent@webpack-internal:///2:5483:9
createElm@webpack-internal:///2:5431:9
patch@webpack-internal:///2:5948:7
lifecycleMixin/Vue.prototype._update@webpack-internal:///2:2617:16
updateComponent@webpack-internal:///2:2745:7
get@webpack-internal:///2:3095:13
Watcher@webpack-internal:///2:3084:7
mountComponent@webpack-internal:///2:2752:3
Vue$3.prototype.$mount@webpack-internal:///2:8359:10
Vue$3.prototype.$mount@webpack-internal:///2:10699:10
init@webpack-internal:///2:4031:7
createComponent@webpack-internal:///2:5483:9
createElm@webpack-internal:///2:5431:9
patch@webpack-internal:///2:5987:9
lifecycleMixin/Vue.prototype._update@webpack-internal:///2:2627:16
updateComponent@webpack-internal:///2:2745:7
get@webpack-internal:///2:3095:13
run@webpack-internal:///2:3172:17
flushSchedulerQueue@webpack-internal:///2:2934:5
nextTick/<@webpack-internal:///2:1796:9
flushCallbacks@webpack-internal:///2:1717:5
vue.esm.js:1699发布于 2018-01-19 07:05:58
问题似乎要么是Firefox没有提供与Vue.js交互的堆栈跟踪,要么是我的构建有问题。
我换成了Chrome,得到了一个非常有用的工具。堆栈跟踪显示来自原始文件的信息。我可以点击转到该文件。我可以设置断点,尽管行似乎是关闭的(由于源映射,我敢肯定)。
一旦我有了功能配置,我对文档的迫切需求就不复存在了。
https://stackoverflow.com/questions/48248132
复制相似问题