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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions dev_mode/webpack.config.js
Expand Up @@ -60,6 +60,12 @@ Object.keys(jlab.linkedPackages).forEach(function(name) {
watched[name] = plib.dirname(localPkgPath);
});

// Set up source-map-loader to look in watched lib dirs
let sourceMapRes = Object.values(watched).reduce((res, name) => {
res.push(new RegExp(name + '/lib'));
return res;
}, []);

/**
* Sync a local path to a linked package path if they are files and differ.
*/
Expand Down Expand Up @@ -165,10 +171,9 @@ module.exports = [
{ test: /\.txt$/, use: 'raw-loader' },
{
test: /\.js$/,
include: sourceMapRes,
use: ['source-map-loader'],
enforce: 'pre',
// eslint-disable-next-line no-undef
exclude: /node_modules/
enforce: 'pre'
},
{ test: /\.(jpg|png|gif)$/, use: 'file-loader' },
{ test: /\.js.map$/, use: 'file-loader' },
Expand Down
11 changes: 8 additions & 3 deletions jupyterlab/staging/webpack.config.js
Expand Up @@ -60,6 +60,12 @@ Object.keys(jlab.linkedPackages).forEach(function(name) {
watched[name] = plib.dirname(localPkgPath);
});

// Set up source-map-loader to look in watched lib dirs
let sourceMapRes = Object.values(watched).reduce((res, name) => {
res.push(new RegExp(name + '/lib'));
return res;
}, []);

/**
* Sync a local path to a linked package path if they are files and differ.
*/
Expand Down Expand Up @@ -165,10 +171,9 @@ module.exports = [
{ test: /\.txt$/, use: 'raw-loader' },
{
test: /\.js$/,
include: sourceMapRes,
use: ['source-map-loader'],
enforce: 'pre',
// eslint-disable-next-line no-undef
exclude: /node_modules/
enforce: 'pre'
},
{ test: /\.(jpg|png|gif)$/, use: 'file-loader' },
{ test: /\.js.map$/, use: 'file-loader' },
Expand Down