Skip to content

Commit ee7d8f6

Browse files
committed
fix(@angular-devkit/build-angular): generate sourcemaps with relative paths in monorepo
With this change we fix the issue that when having a monorepo style workspace, sourcemaps sources references absolute paths. Closes #17046
1 parent e572f37 commit ee7d8f6

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
489489
],
490490
plugins: [PnpWebpackPlugin.moduleLoader(module)],
491491
},
492-
context: projectRoot,
492+
context: root,
493493
entry: entryPoints,
494494
output: {
495495
futureEmitAssets: true,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as fs from 'fs';
2+
3+
import { isAbsolute } from 'path';
4+
import { ng } from '../../utils/process';
5+
6+
export default async function () {
7+
// General secondary application project
8+
await ng('generate', 'application', 'secondary-project', '--skip-install');
9+
await ng('build', 'secondary-project');
10+
11+
12+
await ng('build', '--output-hashing=none', '--source-map');
13+
const content = fs.readFileSync('./dist/secondary-project/main.js.map', 'utf8');
14+
const {sources} = JSON.parse(content);
15+
for (const source of sources) {
16+
if (isAbsolute(source)) {
17+
throw new Error(`Expected ${source} to be relative.`);
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)