Skip to content

Can't get angular to work with protobuf #2373

@jiaqi

Description

@jiaqi

🐞 bug report

Affected Rule

The issue is presented the rule: rollup_bundle but it occurs when multiple rules combine to support angular and protobuf so it's hard to say the problem is isolated in a single rule.

Is this a regression?

Yes, this bug was not present before this change where various rules and dependencies were upgraded.

Description

When an angular(10.0.0) app depends on protobuf ts library as demo'ed in this PR, the import statement of proto is not resolved by rollup_bundle.

🔬 Minimal Reproduction

Checkout the branch(https://github.com/jiaqi/angular-on-java/tree/proto) of the demo PR, build with

bazel build webapp/aoj:js_bundle.

Open the result file

less bazel-bin/webapp/aoj/js_bundle/index.js

The first line is

import { Thing } from 'angular_on_java/webapp/aoj/app/thing_pb';

If I understand it right, the import statements should all be resolved at this point.

🔥 Exception or Error

The build can pass but with --define=VERBOSE_LOGS=1 , we can see the warning showing that the proto ts library is not resolved.


...
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
angular_on_java/webapp/aoj/app/thing_pb (imported by bazel-out/darwin-fastbuild/bin/webapp/aoj/app/app.mjs)

...

🌍 Your Environment

Operating System:

macOS 10.15.7

Output of bazel version:

bazel 3.7.1-homebrew

Rules_nodejs version:

2.3.2

Anything else relevant?

I'm using rules_nodejs 2.3.2 in this project. I haven't got 3.0.0 to work. Combining 3.0.0 with protobuf gave me a lot more trouble so I stopped trying. If that's the way to go I will file separate issue but let's keep the focus of this issue on rule_nodejs 2.3.* and protobuf. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Can Close?We will close this in 30 days if there is no further activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions