Enable typescript sourcemaps for debugging locally installed labextensions #7541
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, whenjupyter 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 inwebpack
.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 inwebpack
) 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 todev_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
:Backwards-incompatible changes
None