Skip to content

Commit 79a46d0

Browse files
AlanKeen Yee Liau
authored andcommitted
fix(@angular-devkit/build-angular): vendorSourceMap not being recognized when passed directly
Fixes #13414
1 parent 258bc7c commit 79a46d0

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/angular_devkit/build_angular/src/utils/normalize-builder-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ export function normalizeBuilderSchema<BuilderConfigurationT extends
7272
...assets,
7373
fileReplacements: normalizeFileReplacements(options.fileReplacements, syncHost, root),
7474
optimization: normalizeOptimization(optimization),
75-
sourceMap: normalizeSourceMaps(options.sourceMap),
75+
sourceMap: normalizedSourceMapOptions,
7676
};
7777
}

packages/angular_devkit/build_angular/test/browser/vendor-source-map_spec_large.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,29 @@ describe('Browser Builder external source map', () => {
4141
).toPromise().then(done, done.fail);
4242
});
4343

44+
it(`works when using deprecated 'vendorSourceMap'`, (done) => {
45+
const overrides: Partial<BrowserBuilderSchema> = {
46+
sourceMap: {
47+
scripts: true,
48+
styles: true,
49+
},
50+
vendorSourceMap: true,
51+
};
52+
53+
runTargetSpec(host, browserTargetSpec, overrides).pipe(
54+
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
55+
tap(() => {
56+
const fileName = join(outputPath, 'vendor.js.map');
57+
expect(host.scopedSync().exists(fileName)).toBe(true);
58+
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
59+
// this is due the fact that some vendors like `tslib` sourcemaps to js files
60+
const sourcePath = JSON.parse(content).sources[0];
61+
expect(path.extname(sourcePath)).toBe('.ts', `${sourcePath} extention should be '.ts'`);
62+
}),
63+
).toPromise().then(done, done.fail);
64+
});
65+
66+
4467
it('does not map sourcemaps from external library when disabled', (done) => {
4568
const overrides: Partial<BrowserBuilderSchema> = {
4669
sourceMap: {

0 commit comments

Comments
 (0)