starter-template icon indicating copy to clipboard operation
starter-template copied to clipboard

the nuxt/dist/nuxt.js source map are not working with Debug node in Chrome

Open lazycrazy opened this issue 9 years ago • 3 comments

when i use node --inspect debug in chrome devtools the nuxt/dist/nuxt.js file's source map are not working chrome show "source map detected",but in the sources panel only have "no domain" workspace os : win10 (64) node: v7.7.1 chrome: 57.0.2987.98 (64) webpack:2.2.1 image image

This question is available on Nuxt.js community (#c9)

lazycrazy avatar Mar 14 '17 02:03 lazycrazy

I see, but why do you need the source maps @lazycrazy ?

atinux avatar Mar 18 '17 14:03 atinux

@Atinux because it makes development a lot nicer.

When runing node --inspect node_modules/.bin/nuxt and then attaching with your editor (i am using visual studio code but others allow it too) it is possible to set breakpoints. But they only work when sourcemaps are set up correctly. The other way around is possible too. When an exception is thrown your editor could put you directly to the location where it happened. But without proper sourcemaps will open something like 0.nuxt.bundle.xxx.js and then you have to recognize the file you want to open and then open it.

More or less the same applies for in browser debugging.

ssendev avatar Aug 22 '17 14:08 ssendev

@ssendev I had found that use like below command could be used to debug the nuxt application. C:\nodejs\node.exe --inspect-brk=56017 -r babel-register C:\ProjectStack\nuxtjs20170926\node_modules\nuxt\bin\nuxt-dev

but you notice that nuxt using babel-preset-env, and bebel default preset isvue-app. so you need to create a babel file in the project root ,named as .babelrc, content could be like below:

{
  "presets": [
    "vue-app"
  ]
}

Then go on debug it should met you need .

alterhu2020 avatar Sep 27 '17 03:09 alterhu2020