How to change launch.json or package.json for run dev or build in VS Code for 0.15.x



  • with the 0.14.7 version, I use VS Code as below “launch.json”

    "configurations": [
    	{
    		"type": "node",
    		"request": "launch",
    		"name": "Launch Program",
    		"program": "${workspaceRoot}/build/script.dev.js"
    	}
    ]
    

    then, for quasar 0.15.x , what I have to do dev/build in VS Code?

    even I add the dev/build lines in package.json

    “scripts”: {
    “lint”: “eslint --ext .js,.vue src”,
    “test”: “echo “No test specified” && exit 0”,
    “dev”: “quasar dev”,
    “build”: “quasar build”
    }…

    and

    launch.json is modified as below

    	{
    		"type": "node",
    		"request": "launch",
    		"name": "Launch via NPM",
    		    "cwd": "${workspaceFolder}",
    		"runtimeExecutable": "npm",
    		"runtimeArgs": [
    			"run",
    			"dev"
    		],
    		"port": 8080
    	}
    

    but it not work.

    I hope to get help ㅠㅠ



  • @terry Launch is for browsers. Instead why don’t you simply create a npm script in package.json, such as for instance:

    "dev": "quasar dev -m pwa",
    

    and then in vscode Task > Run Task… and chose npm: dev



  • Thanks @LaurentPayot ,

    after add the line in package.json as you comment,
    I also add to this launch.json as below

    “configurations”: [

    	{
    		"type": "node",
    		"request": "launch",
    		"name": "Start quasar",
    		"runtimeExecutable": "npm",
    		"runtimeArgs": [
    			"run-script",
    			"dev"
    		]
    	},
       {
      "type": "chrome",
      "request": "launch",
      "name": "Debug Quasar",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceRoot}",
      "sourceMaps": true,
      "sourceMapPathOverrides": {
        "webpack:///*": "${webRoot}/*"
      }
    	 }
    ],
    

    then once “Start without debugging” ( ^F5) for “Start Quasar” , And then “Start debug” of “Debug quasar” configuration. Then I could start hot-reload state of my app and debug with VS Code, even I am not sure it is the best.



  • I update as below for start debug of “quasar dev” for VS code , It works as I expected. In order debuging in VS code, have to launch “Debug Quasar” after start debug.

    "configurations": [
    
    	   {
    		   "type": "node",
    		   "request": "launch",
    		   "name": "Launch Program",
    		   "program": "/usr/local/bin/quasar",
    		   "args": ["dev"]
    	   },