1

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:

  1. "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.

  1. "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?

1 Answer 1

0
devtool: 'source-map'

recommended in Vue documentation doesn't work in this setup. It started working when I used:

devtool: 'eval-source-map'

after reading Webpack documentation.

I added this option directly to the webpack.config.js file - without using any vue.config.js file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.