更好的堆栈跟踪

时间:2018-01-14 09:10:19

标签: webpack vuejs2 stack-trace

我正在将应用程序从angular.js(版本1)迁移到Vue.js版本2.4。

我正在从在开发模式下提供原始Javascript文件转向使用Webpack,babel和.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

1 个答案:

答案 0 :(得分:0)

问题似乎是Firefox不提供与Vue.js的交互式堆栈跟踪,或者我的构建有问题。

我切换到Chrome并获得了一个非常实用的工具。堆栈跟踪显示原始文件中的信息。我可以点击进入该文件。我可以设置断点,虽然线条似乎是关闭的(由于我确定源数据映射)。

一旦我有功能配置,我对文档的迫切需求就消失了。