I'm trying to figure out the right way to debug apps written in NativeScript-Vue AND using the "vue-cli-template".
There are currently two templates supported:
- "nativescript-vue-template"
This one is much simpler, and debugging it is easy. There is a useful answer on that already. The debugging is done using chrome-devtools. This template doesn't use vue-cli/Webpack/Babel, so the "Sources" that you can view in Chrome are not changed in any way. You can easily set breakpoints there. Just run e.g.:
tns debug android
You can also use the very nice VS Code plugin.
- "vue-cli-template"
This one uses vue-cli/Webpack/Babel, so that the .vue Single File Components can be compiled in different ways.
Using a fresh install of the "vue-cli-template" as an example:
Run:
npm run debug:android
When you view the "Sources" of the "Hello world" demo app provided in the template, the app.js file has 17700 lines of code. It is basically the compiled dist/app/app.android.js file.
I've got some experience with vue-cli based applications. In an application configured according to the Vue documentation, when you view the "Sources" in Chrome dev-tools, apart from the compiled sources you can access the "webpack://" node, which contains the original code. You can set breakpoints there and it works.
Unfortunately the "vue-cli-template" does not work this way. There is no "webpack://" node available. You can only access the compiled sources.
I tried to follow the mentioned Vue documentation to fix this. I'm supposed to add
module.exports = {
configureWebpack: {
devtool: 'source-map'
}
}
to the vue.config.js file. The template does not have it. Should I create one? If so, where? Maybe I need other Webpack configurations?