Skip to content

Commit

Permalink
fix(bazel): disable angular linker sourcemaps
Browse files Browse the repository at this point in the history
When using the linker on `@angular/material` or packages which contain external sourcemap. The sourcemap will contain multiple sources example.

Babel now uses [remapping](https://github.com/ampproject/remapping/) to merge sourcemaps, see: babel/babel#14209. This doesn't support multiple sources which the linker produduces. Previously, Babel failed silently and didn't generate a sourcemap angular/angular#42769 at all.

Linker produced sourcemap
```js
  [
    '/packages/web-app-edit/Users/cli-reproductions/monorepo-new/node_modules/@angular/material/fesm2020/card.mjs',
    '/packages/web-app-edit/Users/src/material/card/card.html',
    '/packages/web-app-edit/Users/src/material/card/card-header.html',
    '/packages/web-app-edit/Users/src/material/card/card-title-group.html'
  ]
```

Will cause the below error during merging
```
Transformation map 0 must have exactly one source file.
```

Related to
- angular/angular#42769
- angular/angular#44972

Addresses CI failure
- https://app.circleci.com/pipelines/github/angular/angular/42281/workflows/e060088b-5963-43b0-b6fc-b4ddd8855bee/jobs/1116551
  • Loading branch information
alan-agius4 authored and devversion committed Feb 4, 2022
1 parent 075c464 commit a90f807
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shared-scripts/angular-linker/esbuild-plugin.mjs
Expand Up @@ -60,6 +60,8 @@ export async function createLinkerEsbuildPlugin(
logger: new ConsoleLogger(LogLevel.warn),
// We enable JIT mode as unit tests also will rely on the linked ESM files.
linkerJitMode: true,
// Workaround for https://github.com/angular/angular/issues/42769 and https://github.com/angular/angular-cli/issues/22647.
sourceMapping: false,
...linkerOptions,
});

Expand Down

0 comments on commit a90f807

Please sign in to comment.