Comments (8)
I expected debugging to work out of the box, it doesn't, however it can be fixed by changing webpack.config.js to generate source maps that contain relative links. This way auto attach works automatically, and there is no need to generate launch.json file in vscode:
const { NxWebpackPlugin } = require('@nx/webpack');
const path = require('path');
const outDir = path.join(__dirname, '../../dist/apps/app');
module.exports = {
output: {
devtoolModuleFilenameTemplate(info) {
const { absoluteResourcePath, namespace, resourcePath } = info;
if (path.isAbsolute(absoluteResourcePath)) {
return path.relative(outDir, absoluteResourcePath);
}
// Mimic Webpack's default behavior:
return `webpack://${namespace}/${resourcePath}`;
},
path: outDir,
},
plugins: [
new NxWebpackPlugin({
target: 'node',
compiler: 'tsc',
main: './src/main.ts',
tsConfig: './tsconfig.app.json',
assets: ['./src/assets'],
optimization: false,
outputHashing: 'none',
sourceMap: true
}),
],
};
from nx-console.
It looks like the console is correctly launched with a debugger attached. Can you provide some more context why you think this is an issue with Nx Console vs a misconfiguration in your bundler?
from nx-console.
I just used nx to create this project:
npx create-nx-workspace@latest debugging --name debugging --preset nest --appName app --docker true --nxCloud skip
not using any bundler of my choosing - only what nx uses.
How should I check if this is a problem with nx-console vs something else?
It's either nx-console, or nx generator...
from nx-console.
Did you go through the VSCode troubleshooting steps for unbound breakpoints?
What executor are you using to build your nest app?
Did you set the source map option on your executor?
Did you check whether a sourcemap file was actually generated in the dist folder?
from nx-console.
Ok, i see no source maps are being generated in dist folder.
However, I'm just using default project generated by Nx. can you please point me where should I open an issue for this?
from nx-console.
I fixed the issue with the sourcemaps (added explicitly sourcemap: true in webpack.config.js), but still it won't work.
any suggestions?
from nx-console.
I don't think this is something we should generate by default either way. Source maps potentially take up lots of space so by generating them by default we would increase bundle sizes for everyone. I think keeping them opt-in is smarter.
Closing this issue for now :)
from nx-console.
I do not recall what I upgraded from, but breakpoints in nx-console were working perfectly fine. Generate a new project and run. Exactly what I would expect.
After upgrading, they don't work out of the box. I spent a very large amount of time troubleshooting this and after running into this comment, things work.
The only reason why I use nx-console is to get my nx projects up and running with a simple click. I do not understand why someone decided that debugging shouldn't work out of the box. That is a basic fundamental need when writing code.
I don't think this is something we should generate by default either way. Source maps potentially take up lots of space so by generating them by default we would increase bundle sizes for everyone. I think keeping them opt-in is smarter. Closing this issue for now :)
So it's better to opt people out of basic debugging rights by default? The nx.json/project.json has the ability to know which environment/configurations it's targeting. Pretty simple rule --- if config is dev, sourcemaps = true, else sourcemaps = false. That's how other things work.
Debugging should work out of the box when running in your IDE. Period.
from nx-console.
Related Issues (20)
- affected / run-many watch flag to match run's watch flag HOT 2
- Couldn't find any projects HOT 11
- nx generate process failed to launch HOT 2
- Adding @nrwl/nest dependency using nx console in vscode fails
- Nx console plugin for Webstorm not considering NX_DAEMON_SOCKET_DIR HOT 8
- Custom tasks won't start in VS Code ("There is no task provider registered for tasks of type "nx") HOT 3
- Nx Console 18 showing on Add dependency old @nrwl names HOT 1
- Cannot run NX Console after updating to v18.21.0 in VS Code HOT 2
- Intellij Idea with NX Console opens project.json with Data Editor and Viewer if form of a table HOT 3
- Rerunning a run-many task results in undefined command being run HOT 3
- Error running task: "version is longer than 256 characters" HOT 3
- Spaces being removed in generators parameters in UI HOT 10
- Cannot create nx Workspace HOT 1
- Cannot open generator UI in VSCode HOT 2
- Multiple terminal popups on Windows HOT 7
- "We couldn't find any projects in this workspace" HOT 2
- Windows: descriptions breaks the Generate UI HOT 1
- works if the project is in the root folder HOT 1
- [Jetbrains] Nx Console cannot run any task from IDE if there's a folder named `nx` in workspace root HOT 1
- Nx Console Generate (UI) tab displaying raw HTML instead of generator options UI in Webstorm HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nx-console.