fix(@angular-devkit/build-angular): do not consume inline sourcemaps … · angular/angular-cli@cea0280

File tree

1 file changed

lines changed

  • packages/angular_devkit/build_angular/src/webpack/configs

1 file changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -314,9 +314,20 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {

314314

if (scriptsSourceMap || stylesSourceMap) {

315315

extraRules.push({

316316

test: /\.m?js$/,

317-

exclude: vendorSourceMap ? undefined : /[\\\/]node_modules[\\\/]/,

318317

enforce: 'pre',

319318

loader: require.resolve('source-map-loader'),

319+

options: {

320+

filterSourceMappingUrl: (_mapUri: string, resourcePath: string) => {

321+

if (vendorSourceMap) {

322+

// Consume all sourcemaps when vendor option is enabled.

323+

return true;

324+

}

325+
326+

// Don't consume sourcemaps in node_modules when vendor is disabled.

327+

// But, do consume local libraries sourcemaps.

328+

return !resourcePath.includes('node_modules');

329+

},

330+

},

320331

});

321332

}

322333