Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): vendorSourceMap not being recog…
Browse files Browse the repository at this point in the history
…nized when passed directly

Fixes #13414
  • Loading branch information
Alan authored and kyliau committed Jan 14, 2019
1 parent 258bc7c commit 79a46d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Expand Up @@ -72,6 +72,6 @@ export function normalizeBuilderSchema<BuilderConfigurationT extends
...assets,
fileReplacements: normalizeFileReplacements(options.fileReplacements, syncHost, root),
optimization: normalizeOptimization(optimization),
sourceMap: normalizeSourceMaps(options.sourceMap),
sourceMap: normalizedSourceMapOptions,
};
}
Expand Up @@ -41,6 +41,29 @@ describe('Browser Builder external source map', () => {
).toPromise().then(done, done.fail);
});

it(`works when using deprecated 'vendorSourceMap'`, (done) => {
const overrides: Partial<BrowserBuilderSchema> = {
sourceMap: {
scripts: true,
styles: true,
},
vendorSourceMap: true,
};

runTargetSpec(host, browserTargetSpec, overrides).pipe(
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
tap(() => {
const fileName = join(outputPath, 'vendor.js.map');
expect(host.scopedSync().exists(fileName)).toBe(true);
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
// this is due the fact that some vendors like `tslib` sourcemaps to js files
const sourcePath = JSON.parse(content).sources[0];
expect(path.extname(sourcePath)).toBe('.ts', `${sourcePath} extention should be '.ts'`);
}),
).toPromise().then(done, done.fail);
});


it('does not map sourcemaps from external library when disabled', (done) => {
const overrides: Partial<BrowserBuilderSchema> = {
sourceMap: {
Expand Down

0 comments on commit 79a46d0

Please sign in to comment.