fix(compiler): add an empty content for source file of non mapped code. (#15246)
Before this when using ngc, tools tried to load `ng://…<component>.ts` if `…<component>.ts` was the source file of a template. PR Close #15246
This commit is contained in:

committed by
Miško Hevery

parent
5486e5417b
commit
8415910375
@ -188,7 +188,7 @@ describe('compiler (unbundled Angular)', () => {
|
||||
// for the mapping to the original source file we don't store the source code
|
||||
// as we want to keep whatever TypeScript / ... produced for them.
|
||||
const sourceIndex = sourceMap.sources.indexOf(ngComponentPath);
|
||||
expect(sourceMap.sourcesContent[sourceIndex]).toBe(null);
|
||||
expect(sourceMap.sourcesContent[sourceIndex]).toBe(' ');
|
||||
});
|
||||
}));
|
||||
|
||||
|
@ -57,7 +57,7 @@ export function main() {
|
||||
const sm = emitSourceMap(someVar.toStmt(), [], '/* MyPreamble \n */');
|
||||
|
||||
expect(sm.sources).toEqual([someSourceFilePath, 'in.js']);
|
||||
expect(sm.sourcesContent).toEqual([null, ';;;var']);
|
||||
expect(sm.sourcesContent).toEqual([' ', ';;;var']);
|
||||
expect(originalPositionFor(sm, {line: 3, column: 0}))
|
||||
.toEqual({line: 1, column: 3, source: 'in.js'});
|
||||
});
|
||||
|
@ -62,7 +62,7 @@ export function main() {
|
||||
const sm = emitSourceMap(someVar.toStmt(), [], '/* MyPreamble \n */');
|
||||
|
||||
expect(sm.sources).toEqual([someSourceFilePath, 'in.js']);
|
||||
expect(sm.sourcesContent).toEqual([null, ';;;var']);
|
||||
expect(sm.sourcesContent).toEqual([' ', ';;;var']);
|
||||
expect(originalPositionFor(sm, {line: 3, column: 0}))
|
||||
.toEqual({line: 1, column: 3, source: 'in.js'});
|
||||
});
|
||||
|
Reference in New Issue
Block a user