Skip to content

Commit

Permalink
Merge pull request #7541 from telamonian/typescript-srcmap-for-extens…
Browse files Browse the repository at this point in the history
…ions

Enable typescript sourcemaps for debugging locally installed labextensions
  • Loading branch information
blink1073 committed Nov 21, 2019
2 parents 3755447 + d0a75c1 commit 908ec55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
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

0 comments on commit 908ec55

Please sign in to comment.