I have found a bit of a solution...
- VSCODE: Modify launch.json ...
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"env": { "NODE_ENV": "development" },
"preLaunchTask": "npm: build",
"program": "${workspaceFolder}\\packages\\node_modules\\node-red\\red.js"
}
]
}
- VSCODE: Add an entry in tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": "build",
"problemMatcher": [],
"label": "npm: build",
"detail": "dev build"
}
]
}
Now when you hit F5, npm run build
is executed before the debugger launches.
Its not ideal as the build
task does a whole bunch of other things like 'clean:build','jsonlint','concat:build','concat:vendor','copy:build','uglify:build','sass:build','attachCopyright'
Alternative / better solution...
An alternative solution is to add a new grunt task that does the required joining etc (skips the minification)
- Modify
grunfile.js
to include another task (its the same as grunt dev but without nodemon)
grunt.registerTask('build-dev',
'Developer mode: build dev version',
['clean:build','concat:build','concat:vendor','copy:build','sass:build','setDevEnv']);
- in
package.json
add a new npm script
"build-dev": "grunt build-dev",
- VSCODE: Modify launch.json ...
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"env": { "NODE_ENV": "development" },
"preLaunchTask": "npm: build-dev",
"program": "${workspaceFolder}\\packages\\node_modules\\node-red\\red.js"
}
]
}
- VSCODE: Add an entry in tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build-dev",
"group": "build",
"problemMatcher": [],
"label": "npm: build-dev",
"detail": "build-dev"
}
]
}
This has the benefit of being much quicker due to not minifying the files.
@knolleary would you consider adding this grunt (build-dev
) task to improve the development experience?