I am writing a JupyterLab Extension using Typescript. I want to generate sourcemap and serve the source code during debug mode. Is there a recommended way to do this? Can it be done via configuring the package.json to add the source to output?
What does setting --source-map True in the packaage.json do? Doesn’t seem to work for me.
Thanks for the response. You are right that does generate the sourcemap. However here is what I want to achieve.
Write the extension in typescript. If I turn on sourceMap in tsconfig then I get the .js.map file in the lib folder when tsc runs. This sourceMap is for the Typescript source.
However when webpack does its work to build the labextension it generates another sourceMap for the Javascript that the tsc creates. The final sourceMap is only for the generated Javascript. Is there a way to have the webpack/jlpm bundle the typescript sourcemap instead of the sourcemap for the generated Javascript?
I am closer to figuring it out. In the package.json file, I can specify “webpackConfig” in “jupyterlab”. And jlpm does build the labextension however how should the output definition be so that Jupyterlab can load it properly? Currently I use the following for my webpack.config.js
However it looks like Jupyterlab is expecting lib_index_js..js remoteEntry..js? What should the output be so that I can use a custom webpack.config.js?
Alright, finally figured it out. I need to use both a custom webpack.config.js and source-map-loader | webpack to pass along the sourcemap generated by tsc into the final bundle that jlpm builds.