Skip to content
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

How do you debug @baklavajs/core? #329

Open
yojeek opened this issue Nov 1, 2023 · 3 comments
Open

How do you debug @baklavajs/core? #329

yojeek opened this issue Nov 1, 2023 · 3 comments

Comments

@yojeek
Copy link
Contributor

yojeek commented Nov 1, 2023

Im developing some features in renderer-vue playground by running yarn dev, and I need to set breakpoint in source code from core package. Is it possible to link source code / compiled code with sourcemaps instead of @baklavajs/core somehow? I'm struggling to get it work with yarn/lerna/vite combination.

Thanks.

@newcat
Copy link
Owner

newcat commented Nov 1, 2023

I usually just go into the devtools "Sources" tab and there the transpiled files are available. Since there is no minification going on the transpiled files are pretty readable and it is possible to set breakpoints in there:
grafik

@yojeek
Copy link
Contributor Author

yojeek commented Nov 1, 2023

Sorry, I forgot to specify that the question was related to setting breakpoints from IDE, specifically Webstorm, but VsCode should work the same. I'm trying to work around it by linking with yarn link or yarn add link:<path_to_package> but with no luck yet.

@yojeek
Copy link
Contributor Author

yojeek commented Nov 2, 2023

Got it working finally in WebStorm. Two things were needed:

edit seems that this solution works for some files from core/src but not for all. for instance source for editor.ts for some unclear reason is resolved not to /packages/core/src/editor.ts but to top-level /node_modules/@baklavajs/core/src/editor.ts.

Enable sourcemaps for core

Add corresponding option to packages/core/tsconfig.build.json

{
    "extends": "./tsconfig.json",
    "compilerOptions": {
        "outDir": "dist",
        "sourceMap": true
    },
    "include": ["src/**/*.ts"]
}

Debug configuration

I had to specify Remote URL for renderer-vue to be able to correctly resolve source files with vite :

Screenshot 2023-11-02 at 13 30 42

Run and debug

Now I can run playground and IDE will correctly catch breakpoints both inside core/src and anywhere inrenderer-vue package.

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

No branches or pull requests

2 participants