Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

VSCode Launch.json file issue #393

Closed
BommagantiKrishnaPrasad opened this issue Aug 25, 2020 · 3 comments
Closed

VSCode Launch.json file issue #393

BommagantiKrishnaPrasad opened this issue Aug 25, 2020 · 3 comments

Comments

@BommagantiKrishnaPrasad

I have Launch.json file as shown below in my React application

"name": "Launch Server (Dev Spaces)",
"type": "node",
"request": "launch",
"protocol": "inspector",
"preLaunchTask": "dev-spaces: prelaunch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "azds",
"runtimeArgs": [
"exec",
"--on-exit-resume-up",
"--",
"node",
"--inspect=0.0.0.0:9229",
"--inspect-brk",
"--nolazy",
"src/index.js"
],
"address": "127.0.0.1",
"port": 55215,
"localRoot": "${workspaceFolder}/.",
"remoteRoot": "/app"
},

When I launch the application, I am getting below error.

C:\Program Files\Microsoft SDKs\Azure\Azure Dev Spaces CLI\azds.exe exec --on-exit-resume-up -- node --inspect=0.0.0.0:9229 --nolazy src/index.js
Debugger listening on ws://0.0.0.0:9229/958b2626-f258-4a06-b528-15a84f5e3da2
For help, see: https://nodejs.org/en/docs/inspector
(node:28) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
/sfg/src/index.js:1
import 'babel-polyfill';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1167:16)
at Module._compile (internal/modules/cjs/loader.js:1215:27)
at Object..js (internal/modules/cjs/loader.js:1272:10)
at Module.load (internal/modules/cjs/loader.js:1100:32)
at Function._load (internal/modules/cjs/loader.js:962:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
Process exited with code 1

Please let me know If I am missing something here.

@amsoedal
Copy link
Collaborator

Hi @BommagantiKrishnaPrasad, can you try running your app with the normal launch configuration instead of with Dev Spaces? Do you still get this error, or is it only when you run the Dev Spaces launch configuration? This looks like it might be a compile issue in the react application rather than in Dev Spaces.

@BommagantiKrishnaPrasad
Copy link
Author

BommagantiKrishnaPrasad commented Aug 26, 2020

I updated launch.json with below configuration and all the compilation errors got fixed but break points are not being hit

.----------------------------------------------------------
"name": "Launch Server (Dev Spaces)",
"type": "node",
"request": "launch",
"protocol": "inspector",
"preLaunchTask": "dev-spaces: prelaunch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "azds",
"runtimeArgs": [
"exec",
"--on-exit-resume-up",
"--",
"npm",
"run",
"start"
],
"address": "127.0.0.1",
"port": 55215,
"localRoot": "${workspaceFolder}/.",
"remoteRoot": "/app"
},

Also how can hot reload takes place in dev space. Do I need to add configuration "Attach to Server (Dev Spaces)"?

@amsoedal
Copy link
Collaborator

Hi @BommagantiKrishnaPrasad, I'm sorry to hear the setup is painful for you! Our new extension Local Process with Kubernetes might give you a better experience. It offers many of the same capabilities as Dev Spaces but it "connects" to workloads running in your cluster instead of syncing/running them. You can read more about them here: #341

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants