Skip to content

fix(@angular-devkit/build-angular): fix sourcemaps for vscode breakpo… #15129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function getSourceMapDevTool(
return new SourceMapDevToolPlugin({
filename: inlineSourceMap ? undefined : '[file].map',
include,
moduleFilenameTemplate: '[namespace]/[resource-path]',
moduleFilenameTemplate: '[resource-path]',
append: hiddenSourceMap ? false : undefined,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ describe('Browser Builder source map', () => {
expect(await files['styles.css.map']).not.toBeUndefined();
});

it(`sourcemaps sources should not start with '/'`, async () => {
// If sourcemaps sources start with a '/' it will break VS code breakpoints
// Unless 'sourceMapPathOverrides' are provided
const overrides = {
sourceMap: true,
};

const { files } = await browserBuild(architect, host, target, overrides);
const mainJSMap = await files['main.js.map'];
expect(mainJSMap).not.toBeUndefined();

const sources: string[] = JSON.parse(mainJSMap).sources;
for (const source of sources) {
expect(source.startsWith('/')).toBe(false, `${source} started with an '/'.`);
}
});

it('works with outputHashing', async () => {
const { files } = await browserBuild(architect, host, target, {
sourceMap: true,
Expand Down