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

Debugging with source maps #43

Open
danyill opened this issue Sep 18, 2023 · 0 comments
Open

Debugging with source maps #43

danyill opened this issue Sep 18, 2023 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@danyill
Copy link
Collaborator

danyill commented Sep 18, 2023

I've been using scl-lib in an OpenSCD core extension.

When I set a break point and try to trace through scl-lib, it fails because the source map refers to information not included in the package. This is true for a plugin which I am testing on locally (using @web/dev-server), however it does not appear to be a problem on the built plugin (using rollup).

For example, locally I have installed the current scl-lib version (0.5.9) and am trying to debug the insertIED function:

What I see in my node_modules folder is (truncated view):

scl-lib
├── dist
│   |── tIED
│        ├── insertIED.d.ts
│        ├── insertIED.js
│        └── insertIED.js.map
├── package.json
└── README.md

If I open node_modules/@openenergytools/scl-lib/dist/tIED/insertIED.js.map, the reference is to ../../tIED/insertIED.ts

{"version":3,"file":"insertIED.js","sourceRoot":"","sources":["../../tIED/insertIED.ts"],"names":[],"mappings":"A

but these files are not included in the package...

I think this is why my browser barfs at it with the following 404:

Could not load content for http://localhost:8000/node_modules/@openenergytools/scl-lib/tIED/insertIED.ts (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)

image

For now, I've unticked "Enable JavaScript Source Maps" to force Chrome to use only the Javascript and not look for the Typescript files.

Ideally we'd either:

  • disable source maps in the build process or
  • include the typescript files in the build output
@danyill danyill added the enhancement New feature or request label Sep 18, 2023
@JakobVogelsang JakobVogelsang added this to the Publish 1.0.0 milestone Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants