Not sure if this is a VSCode issue, a micro-dev issue or a PEBCAK issue here. And may be related to #21.
We originally had a setup where we were using nodemon over Micro to watch for changes and restart the server when changes were detected. However, I couldn't get it to play nice with Visual Studio Code for some reason.
Whilst researching around this, I stumbled across this seemingly new micro-dev and have been using it, and it looks cool! I love the more dev-friendly nature of it. And the hot-reloading looked like the solution to our nodemon VSCode issues. We want debugging and what have you, but we also (ideally) want hot reloading.
I've set up this VSCode launch configuration. It correctly launches and I can debug normally. And if I change the files, it does (apparently) restart the server. However, if I change one of the files to insert a new console log or similar and save, when I then perform the action, nothing new is logged. And if I hit a breakpoint after the server restart, adding a new variable, VSCode acts as though it is not there and throws a ReferenceError if I try and call it. It is as though the change wasn't there.
Oddly enough, Aurelia Watch on the front end seems to work fine. Though... I don't get debug support there, console logs and such will work.
Here's my launch configuration if it helps:
{
"type": "node",
"request": "launch",
"name": "Launch API dev",
"cwd": "${workspaceRoot}/api/content",
"program": "${workspaceRoot}/api/content/node_modules/micro-dev/bin/micro-dev.js",
"restart": true,
"args": [
"src/gateway.js"
]
}
The restart: true was just added just in case it prompts VS to restart itself on a hot-reload. Bit of a shot in the dark
Any ideas on this? Not sure if a fix to #21 would fix this too, or it may be completely unrelated. Or maybe it's something I'm not doing right.
Not sure if this is a VSCode issue, a micro-dev issue or a PEBCAK issue here. And may be related to #21.
We originally had a setup where we were using nodemon over Micro to watch for changes and restart the server when changes were detected. However, I couldn't get it to play nice with Visual Studio Code for some reason.
Whilst researching around this, I stumbled across this seemingly new micro-dev and have been using it, and it looks cool! I love the more dev-friendly nature of it. And the hot-reloading looked like the solution to our nodemon VSCode issues. We want debugging and what have you, but we also (ideally) want hot reloading.
I've set up this VSCode launch configuration. It correctly launches and I can debug normally. And if I change the files, it does (apparently) restart the server. However, if I change one of the files to insert a new console log or similar and save, when I then perform the action, nothing new is logged. And if I hit a breakpoint after the server restart, adding a new variable, VSCode acts as though it is not there and throws a ReferenceError if I try and call it. It is as though the change wasn't there.
Oddly enough, Aurelia Watch on the front end seems to work fine. Though... I don't get debug support there, console logs and such will work.
Here's my launch configuration if it helps:
{ "type": "node", "request": "launch", "name": "Launch API dev", "cwd": "${workspaceRoot}/api/content", "program": "${workspaceRoot}/api/content/node_modules/micro-dev/bin/micro-dev.js", "restart": true, "args": [ "src/gateway.js" ] }The restart: true was just added just in case it prompts VS to restart itself on a hot-reload. Bit of a shot in the dark
Any ideas on this? Not sure if a fix to #21 would fix this too, or it may be completely unrelated. Or maybe it's something I'm not doing right.