fix(ngcc): do not inline source-maps for non-inline typings source-maps (#37363)
Inline source-maps in typings files can impact IDE performance so ngcc should only add such maps if the original typings file contains inline source-maps. Fixes #37324 PR Close #37363
This commit is contained in:

committed by
Matias Niemelä

parent
15cf7fcac2
commit
b4e26b5828
@ -42,8 +42,16 @@ export function renderSourceAndMap(
|
||||
|
||||
const rawMergedMap: RawSourceMap = generatedFile.renderFlattenedSourceMap();
|
||||
const mergedMap = fromObject(rawMergedMap);
|
||||
if (generatedFile.sources[0]?.inline) {
|
||||
// The input source-map was inline so make the output one inline too.
|
||||
const firstSource = generatedFile.sources[0];
|
||||
if (firstSource && (firstSource.rawMap !== null || !sourceFile.isDeclarationFile) &&
|
||||
firstSource.inline) {
|
||||
// We render an inline source map if one of:
|
||||
// * there was no input source map and this is not a typings file;
|
||||
// * the input source map exists and was inline.
|
||||
//
|
||||
// We do not generate inline source maps for typings files unless there explicitly was one in
|
||||
// the input file because these inline source maps can be very large and it impacts on the
|
||||
// performance of IDEs that need to read them to provide intellisense etc.
|
||||
return [
|
||||
{path: generatedPath, contents: `${generatedFile.contents}\n${mergedMap.toComment()}`}
|
||||
];
|
||||
|
Reference in New Issue
Block a user