fix(compiler-cli): ensure source-maps can handle webpack:// protocol (#32912)

Webpack and other build tools sometimes inline the contents of the
source files in their generated source-maps, and at the same time
change the paths to be prefixed with a protocol, such as `webpack://`.

This can confuse tools that need to read these paths, so now it is
possible to provide a mapping to where these files originated.

PR Close #32912
This commit is contained in:
Pete Bacon Darwin
2020-06-14 23:19:36 +01:00
committed by Andrew Kushnir
parent 6abb8d0d91
commit decd95e7f0
3 changed files with 77 additions and 5 deletions

View File

@ -35,7 +35,7 @@ export function renderSourceAndMap(
{file: generatedPath, source: generatedPath, includeContent: true});
try {
const loader = new SourceFileLoader(fs, logger);
const loader = new SourceFileLoader(fs, logger, {});
const generatedFile = loader.loadSourceFile(
generatedPath, generatedContent, {map: generatedMap, mapPath: generatedMapPath});