-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging of Vite + Lit + TS problematic using VS Code. #12265
Comments
I also have then same issue. I have a monorepo, an app and several workspace dependencies. Breakpoints have the same problem for the app and for the workspace dependencies the breakpoints don't work all. If you look at the loaded scripts in vscode the source typescript files are loaded, but using vscode's breakpoint trouble shooting feature the source typescript mappings aren't resolved. If you open the typescript file from the loaded scripts it opens a version that you can set breakpoints in but it is not the original source file. |
I too have a pnpm monorepo and vite looked promising when I switched over from @web/dev-server-esbuild. Everything in vite worked good and there's lots of customization you can do, but not being able to debug workspace dependencies for my lit project in vscode got extremely frustrating. Nothing I did could get it to work. So,I decided to create a new pnpm workspace project for my lit monorepo using @web/dev-server-esbuild and instead of using the one I was previously was using before I switched over to vite. And it was so easy to set up again from scratch, debugging from workspace dependencies just worked and it is blazing fast. And this time around I added @web/dev-server-hmr. So, now development is even faster. Vite has a lot of documentation, but none of it is in depth. Perfect example is their config docs. All of it is high level documentation that just gives you a summary of each feature. And I love that there is a lot of examples in their example repo on GitHub, but there is no documentation or in depth comments explaining anything. A lot of stuff in those examples is not standard stuff, but specific to Vite. And if their documentation doesn’t cover it then how are we supposed to know. Some stuff is standard and others you can just follow but there is a lot that is not. Modern Web doesn’t have in-depth documentation, but it isn’t needed. Especially bc their stuff follows the standards. Vite was nice to use, but I felt like it was to rigid and that everything was too tightly coupled. |
@djarekg see the issue linked right above your comment. #12743 And yes, I agree. There is a huge issue with End-To-End / Integration testing in Open Source. Claiming something works with |
We experience the same issue with our npm + lerna monorepo. In |
This seems not to happen if the break point is set before the browser is opened.
As it works properly if the break point is set after the browser is opened, I guess this is a bug in the VSCode debugger or Chrome. |
Possibly related issue: firefox-devtools/vscode-firefox-debug#335 |
Describe the bug
I discovered that the default Vite + Lit + TS project has issues with hitting breakpoints set on the local TS source within VS Code, prior to starting the dev server:
Breakpoint set in code here:
Dev server started up, debugger instead breaks here:
This experience is extrapolated for any subsequent static or dynamic local TS module imports.
Upon further investigation, I discovered this strange behaviour within the browser sources:
/src/my-element.ts
file is exposed./src/my-element.ts
file actually looks like transpiled JS, not TS./src/my-element.ts
.Observations:
/src/my-element.ts
), instead of the second source file.I've searched through the Issues, Discussions and PRs and found several related pieces of info, but no clear solution is evident.
Reproduction
https://github.com/stefan505/vite-lit-ts-debug-repro
Steps to reproduce
npm i
within the root.code .
within the root to open in VS Code../src/my-element.ts
(the click handler). See screenshot above.F5
to start up the JS debugger + browser launch.System Info
System: OS: macOS 13.2.1 CPU: (10) arm64 Apple M1 Pro Memory: 198.02 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.11.0 - /opt/homebrew/bin/node npm: 8.19.2 - /opt/homebrew/bin/npm Browsers: Chrome: 110.0.5481.177 Firefox: 108.0.2 Safari: 16.3 npmPackages: vite: ^4.1.0 => 4.1.4
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: