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

Enable typescript sourcemaps for debugging locally installed labextensions #7541

Merged

Conversation

telamonian
Copy link
Member

@telamonian telamonian commented Nov 20, 2019

Our webpack config for the release build is currently broken w.r.t. source maps in labextensions. Effectively, what happens right now is that even if an extension ships it's own typescript source maps in perfect working order, when jupyter lab build is run those .js.map files will be thrown out in favor of (javascript, not typescript) source maps produced by the source map tool in webpack.

This is a minimal fix that just covers the case of a locally installed extension. There are other use cases that we should maybe support (normally installed extensions, core packages in a release build), but we should definitely support typescript source maps for labextensions under active development (ie locally installed extensions).

References

This issue has been fixed and was rebroken at least once before. I think the complexity of having two source map tools (one in tsc and one in webpack) in the build chain, each with their own arcane set of options, probably has something to do with it.

refs:
#2922 (original fix)
#3093 (rebreak)
jupyterlab/jupyterlab-git#447 (example of PR to correctly configure ts source maps in an extension)

Code changes

Made needed tweaks to jupyterlab/staging/webpack.config.js and copied them over to dev_mode/webpack.config.js

User-facing changes

Extension devs will get typescript source maps to use when debugging local extensions in eg DevTools, given the correct config . Easiest config is to make sure the following is in tsconfig.json:

{
  "compilerOptions": {
    "inlineSources": true,
    "sourceMap": true,
    ...
  },
  ...
}

Backwards-incompatible changes

None

@jupyterlab-dev-mode
Copy link

@jupyterlab-dev-mode jupyterlab-dev-mode bot commented Nov 20, 2019

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

Copy link
Member

@blink1073 blink1073 left a comment

Thanks!

@blink1073 blink1073 added this to the 2.0 milestone Nov 21, 2019
@blink1073 blink1073 merged commit 908ec55 into jupyterlab:master Nov 21, 2019
10 checks passed
@lock lock bot added the status:resolved-locked label Dec 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked tag:Build System
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants