Wrong imports written by tree-shakable providers under Bazel #23917
Labels
area: bazel
Issues related to the published `@angular/bazel` build rules
freq1: low
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
type: bug/fix
Milestone
Tree-shakable providers trigger the Angular compiler to introduce import statements in user's code, which we didn't do before. It turns out we have places where we conflate module paths on disk with module names (earlier versions of the compiler didn't have this distinction)
So we end up writing imports like
import {} from 'wksp/packages/path/to/thing'
that should have beenimport {} from '@pkg_name/path/to/thing'
As far as we know, this issue only affects Bazel users who compile with
ngc
and use tree-shakable providers. So far we have only seen this issue internally in Angular.This was found as part of #20030
To repro, add a tree-shakable provider e.g. paste into
packages/common/src/common_module.ts
then build the npm package
bazel build //packages/common:npm_package
And look for the string
angular/packages
in the output:we remove ngsummary files because these always have had paths on disk as module identifiers.
ngfactory files are not shipped with the package so these are probably harmless too.
Interestingly, we find the bad import in the ES2015 output:
bin/packages/common/src/common_module.closure.js
but not in the ES5 output
bin/packages/common/src/common_module.js
The text was updated successfully, but these errors were encountered: