I am trying to get Visual Studio Code to launch webpack's "webpack-dev-server" command, but no matter what configuration I use in launch.json I get an error.
My current launch.json looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "./node_modules/.bin/webpack-dev-server.cmd",
"stopOnEntry": false,
"args": ["-d --hot --inline"],
"cwd": ".",
"runtimeExecutable": null,
"runtimeArgs": [],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"sourceMaps": true,
"outDir": "null"
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858
}
]
}
Current error is:
cannot launch program 'c:\ftct\node_modules\.bin\webpack-dev-server.cmd'; setting the 'outDir' attribute might help
I have tried setting the outDir to some value or other, but it complains about setting this attribute nonetheless.
Any ideas? This is what feels like the final hurdle in my migrating from Visual Studio 2015 to Visual Studio Code!
Anyone running into this, I was able to get it to work with this:
{
"type": "node",
"request": "launch",
"name": "Start JS",
"program": "${workspaceFolder}/node_modules/webpack-dev-server/bin/webpack-dev-server",
"args": [
"--config",
"webpack.javascript.js",
"--hot",
"--progress"
],
"console": "internalConsole",
"internalConsoleOptions": "openOnSessionStart"
},
This is using a custom webpack.javascript.js
config file. If you use the default you can probably remove the first two args. Formatting is a little message in the console on start but it works including hitting breakpoints.
This is in the latest VS Code at the time of this writing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With