angular-docs-cn/packages/bazel
Paul Gschwendtner cd0451305a fix(bazel): replay compilation uses wrong compiler for building esm5 (#28053)
With the update to TypeScript 3.2.x, a big issue seems to have appeared for downstream Bazel users. If the downstream user still uses a lower TypeScript version, normal Bazel targets using the `ng_module` rule are still compiled with the correct/old TypeScript version (assuming they set the `node_modules` attribute properly).

But, if they build the previous Bazel targets by specifying them within a `ng_package` rule, the TypeScript version from the Angular `workspace` is being used for the replayed ESM5 compilation. This is because we resolve the replay compiler to `ngc_wrapped` or `tsc_wrapped` Bazel executables which are defined as part of the `angular` workspace. This means that the compilers are different if the downstream user uses `ngc-wrapped` from the `@npm` repository because the replayed compilation would use the compiler with `@ngdeps//typescript`.

In order to fix this, we should just use the compiler that is defined in the `@angular//BUILD.bazel` file. This target by defaults to the "@npm" workspace which is working for downstream users. This is similar to how it is handled for `tsc-wrapped`. `tsc-wrapped` works as expected for downstream users.

**Note**: This is not the ideal solution because ideally we would
completely respect the `compiler` option from the base `ng_module`, but
this is not possible in a hermetic way, unless we somehow accept the
`compiler` as an attribute that builds all transitive deps. This is
something we should explore in the future. For now, we just fix this in
a reasonable way that is also used for `tsc_wrapped` from the TypeScript
rules.

PR Close #28053
2019-01-14 10:44:24 -08:00
..
docs docs(bazel): add skydoc generation (#23544) 2018-08-08 13:12:07 -07:00
src fix(bazel): replay compilation uses wrong compiler for building esm5 (#28053) 2019-01-14 10:44:24 -08:00
test build: bump year (#27880) 2019-01-11 11:15:59 -08:00
BUILD.bazel build: restrict visibility of npm_package targets (#27611) 2018-12-14 10:20:40 -08:00
check_version.js fix(bazel): fix major/minor semver check between @angular/bazel npm packager version and angular bazel repo version (#27635) 2018-12-13 10:59:14 -08:00
index.bzl build: use bazel version from node modules (#26691) 2018-10-30 16:19:13 -04:00
package.bzl build(bazel): Bump @bazel/typescript & @bazel/karma to 0.22.1 (#28031) 2019-01-10 16:49:56 -08:00
package.json build(bazel): Bump @bazel/typescript & @bazel/karma to 0.22.1 (#28031) 2019-01-10 16:49:56 -08:00
protractor-utils.js build: idiomatic install of @angular/bazel npm package (#26258) (#26488) 2018-10-19 20:59:29 -07:00
yarn.lock build(bazel): Bump @bazel/typescript & @bazel/karma to 0.22.1 (#28031) 2019-01-10 16:49:56 -08:00