简体   繁体   中英

Watches not working in vscode? (Vuejs)

It took me a while to get the debugger to work within Visual Studio Code. Now the program breaks on set breakpoints inside of .vue files/components. But none of the watches seem to work. They are either undefined or unavailable, even when the variables have been created.

The settings I use in launch.json :

{   
    "name": "chrome debug",
    "type": "chrome",
    "request": "launch",
    "port": 3000,
    "url": "http://localhost:3000/admin",
    "webRoot": "${workspaceFolder}",
    "breakOnLoad": true
    // "sourceMapPathOverrides": {
    //     "webpack:///src/*": "${webRoot}/*"
    // }
}

I build my app through npm run build or npm run devbuild which, by my knowlegde, 'compiles' the .vue components into Javascript files. And then start the app with either npm start or nodemon index.js .

Package.json

  "scripts": {
    <...>
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
    "devbuild": "cross-env NODE_ENV=development webpack --progress --hide-modules",
    <...>
  },

例

Have you ever tried add a new script with nodemon? Something like this:

"newScript": "nodemon -L -e ts,json --watch . --exec \\"npm run build || npm run devbuild\\""

-L = Though this should be a last resort as it will poll every file it can find. -e = By default, nodemon looks for files with the .js, .mjs, .coffee, .litcoffee, and .json extensions. If you use the --exec option and monitor app.py nodemon will monitor files with the extension of .py. However, you can specify your own list with the -e (or --ext) switch like so: nodemon -e js,jade --watch . = To watch all the changes on the path, in this case all the code on the current path. (I got all of this information from the documentation .

then, run the command:

npm run newScript

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM