Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 5c442a9

Browse files
clydinfilipesilva
authored andcommitted
fix(@angular-devkit/build-angular): support server sourcemaps
Fixes: angular/angular-cli#10680
1 parent 3307679 commit 5c442a9

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { WebpackConfigOptions } from '../build-options';
1717
export function getServerConfig(wco: WebpackConfigOptions) {
1818

1919
const config: any = {
20+
devtool: wco.buildOptions.sourceMap ? 'source-map' : false,
2021
resolve: {
2122
mainFields: [
2223
...(wco.supportES2015 ? ['es2015'] : []),

packages/angular_devkit/build_angular/test/server/base_spec_large.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,19 @@ describe('Server Builder', () => {
3030
}),
3131
).subscribe(undefined, done.fail, done);
3232
}, Timeout.Standard);
33+
34+
it('supports sourcemaps', (done) => {
35+
const overrides = { sourceMap: true };
36+
37+
runTargetSpec(host, { project: 'app', target: 'server' }, overrides).pipe(
38+
tap((buildEvent) => {
39+
expect(buildEvent.success).toBe(true);
40+
41+
const fileName = join(outputPath, 'main.js');
42+
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
43+
expect(content).toMatch(/AppServerModuleNgFactory/);
44+
expect(host.scopedSync().exists(join(outputPath, 'main.js.map'))).toBeTruthy();
45+
}),
46+
).subscribe(undefined, done.fail, done);
47+
}, Timeout.Standard);
3348
});

0 commit comments

Comments
 (0)