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

Add sourcemaps back to original TS #76

Open
blink1073 opened this issue May 23, 2020 · 10 comments
Open

Add sourcemaps back to original TS #76

blink1073 opened this issue May 23, 2020 · 10 comments

Comments

@blink1073
Copy link
Contributor

blink1073 commented May 23, 2020

When debugging in JupyterLab (with the UMD bundles introduced in #40), I am seeing the ES6 bundle, we should be able to reach back to the original TS source files:

image

@telamonian
Copy link
Member

telamonian commented Jun 25, 2020

I've researched this and the related issues extensively. This will require two things:

  • include the ts sources in the released @lumino packages. Can be done in one of two ways:

    1. add "inlineSources": true to the tsconfig.json of each package
    2. (my pick) include the src dir with the actual .ts sources in the release of each package
  • tweak the jlab webpack build to include the sourcemaps produced by tsc for the @lumino packages

    • change this line to something like

      include: [...sourceMapRes, '@lumino'],
      

@blink1073
Copy link
Contributor Author

I agree with adding src back to the release.

@GordonSmith
Copy link
Contributor

"src" is already included in the packages (I didn't think it got removed?): https://github.com/jupyterlab/lumino/blob/master/packages/widgets/package.json#L23
https://cdn.jsdelivr.net/npm/@lumino/widgets/

Unless I missed some by mistake?

@GordonSmith
Copy link
Contributor

Also if you look in the map files you should see that the bundled versions map back to the ts files in question: https://cdn.jsdelivr.net/npm/@lumino/widgets@1.13.2/dist/index.js.map

@blink1073
Copy link
Contributor Author

I don't see src in node_modules:

$ ls node_modules/@lumino/coreutils/
.            ..           LICENSE      lib          package.json

@GordonSmith
Copy link
Contributor

Its there in the released package: https://cdn.jsdelivr.net/npm/@lumino/coreutils@1.5.2/package.json

@GordonSmith
Copy link
Contributor

@blink1073
Copy link
Contributor Author

Looks good yeah, my other folder had 1.4.2.

image

@GordonSmith
Copy link
Contributor

If your using WebPack to build your project and your including JS files which in turn already have a source map associated with them (like from TS) then you should be using source-map-loader.

Example here: https://github.com/GordonSmith/HPCC-Platform/blob/eclwatch-8.x/esp/src/webpack.config.js#L95-L99

@GordonSmith
Copy link
Contributor

You might need to change the "devTool" for non production builds as well: https://github.com/GordonSmith/HPCC-Platform/blob/eclwatch-8.x/esp/src/webpack.config.js#L111 (not 100% sure)

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

3 participants