Skip to content
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

Angular package format detection doesn't work for Ivy-only packages #927

Closed
alexeagle opened this issue Jul 19, 2019 · 9 comments
Closed
Assignees
Labels
Can Close? We will close this in 30 days if there is no further activity

Comments

@alexeagle
Copy link
Collaborator

alexeagle commented Jul 19, 2019

"dependencies": {
"@angular/core": "angular/core-builds#master-ivy-aot",
}

doesn't contain metadata.json files so our detection logic here
https://github.com/bazelbuild/rules_nodejs/blob/818cfb2291a8fa9f683d16e8dcc24af7b0eb2870/internal/npm_install/generate_build_file.js#L695-L707
fails

@kyliau kyliau self-assigned this Jul 19, 2019
@kyliau
Copy link
Collaborator

kyliau commented Jul 19, 2019

context: https://github.com/angular/core-builds/tree/master-ivy-aot
It looks like there is no "special" file here that we could use to detect APF.
Idea: for snapshots, we could include a magic file in repo to indicate angular package format.

@kyliau
Copy link
Collaborator

kyliau commented Jul 19, 2019

For third party packages published to npm we recommend running ngcc and bundling metadata.json so that wouldn't be a problem in the short term.

kyliau added a commit to kyliau/angular that referenced this issue Jul 19, 2019
Ivy snapshots no longer contain metadata.json which breaks the detection logic for
Angular Package Format (APF) in npm/yarn install.
This PR adds ANGULAR_PACAKGE as a magic file to denote APF.
See bazel-contrib/rules_nodejs#927
kyliau pushed a commit to kyliau/rules_nodejs that referenced this issue Jul 20, 2019
metadata.json are no longer produced in Ivy mode, and this breaks the
detection logic for Angular Package Format (APF).
As a stop gap solution for the snapshot builds, use 'ng-update' field in
package.json to detect APF.

Closes bazel-contrib#927
kyliau pushed a commit to kyliau/rules_nodejs that referenced this issue Jul 20, 2019
metadata.json are no longer produced in Ivy mode, and this breaks the
detection logic for Angular Package Format (APF).
As a stop gap solution for the snapshot builds, use 'ng-update' field in
package.json to detect APF.

Closes bazel-contrib#927
kyliau added a commit to kyliau/angular that referenced this issue Jul 30, 2019
Ivy snapshots no longer contain metadata.json which breaks the detection logic for
Angular Package Format (APF) in npm/yarn install.
This PR adds ANGULAR_PACAKGE as a magic file to denote APF.
See bazel-contrib/rules_nodejs#927
kyliau pushed a commit to kyliau/rules_nodejs that referenced this issue Jul 30, 2019
metadata.json are no longer produced in Ivy mode, and this breaks the
detection logic for Angular Package Format (APF).
As a stop gap solution for the snapshot builds, use 'ng-update' field in
package.json to detect APF.

Closes bazel-contrib#927
kyliau pushed a commit to kyliau/rules_nodejs that referenced this issue Jul 30, 2019
metadata.json are no longer produced in Ivy mode, and this breaks the
detection logic for Angular Package Format (APF).
As a stop gap solution for the snapshot builds, use ANGULAR_PACKAGE
magic file in the package to detect APF.

Closes bazel-contrib#927
kyliau pushed a commit to kyliau/rules_nodejs that referenced this issue Jul 30, 2019
metadata.json are no longer produced in Ivy mode, and this breaks the
detection logic for Angular Package Format (APF).
As a stop gap solution for the snapshot builds, use ANGULAR_PACKAGE
magic file in the package to detect APF.

Closes bazel-contrib#927
kyliau pushed a commit to kyliau/rules_nodejs that referenced this issue Jul 30, 2019
metadata.json are no longer produced in Ivy mode, and this breaks the
detection logic for Angular Package Format (APF).
As a stop gap solution for the snapshot builds, use ANGULAR_PACKAGE
magic file in the package to detect APF.

Closes bazel-contrib#927
mhevery pushed a commit to angular/angular that referenced this issue Aug 29, 2019
Ivy snapshots no longer contain metadata.json which breaks the detection logic for
Angular Package Format (APF) in npm/yarn install.
This PR adds ANGULAR_PACAKGE as a magic file to denote APF.
See bazel-contrib/rules_nodejs#927

PR Close #31900
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this issue Sep 6, 2019
Ivy snapshots no longer contain metadata.json which breaks the detection logic for
Angular Package Format (APF) in npm/yarn install.
This PR adds ANGULAR_PACAKGE as a magic file to denote APF.
See bazel-contrib/rules_nodejs#927

PR Close angular#31900
gregmagolan added a commit to gregmagolan/rules_nodejs that referenced this issue Sep 9, 2019
…found

This file is used by the npm/yarn_install rule to detect APF. See bazel-contrib#927
alexeagle pushed a commit that referenced this issue Sep 9, 2019
…found (#1112)

This file is used by the npm/yarn_install rule to detect APF. See #927
@pauldraper
Copy link

a magic file in repo to indicate angular package format.

I thought that was metadata.json.

@alexeagle
Copy link
Collaborator Author

Nope, metadata.json is a View-Engine-specific artifact.

@gregmagolan gregmagolan modified the milestones: 1.0, Angular v10 Sep 19, 2019
arnehoek pushed a commit to arnehoek/angular that referenced this issue Sep 26, 2019
Ivy snapshots no longer contain metadata.json which breaks the detection logic for
Angular Package Format (APF) in npm/yarn install.
This PR adds ANGULAR_PACAKGE as a magic file to denote APF.
See bazel-contrib/rules_nodejs#927

PR Close angular#31900
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

@github-actions github-actions bot added the Can Close? We will close this in 30 days if there is no further activity label Oct 15, 2020
@codebreach
Copy link

Is rules_nodejs compatible with IVY?

Sorry I couldn't find any information elsewhere.

The angular/components and angular/angular repos seem to use angular/bazel with their own internal rules but angular/bazel is deprecated so just wanted to understand what is the correct way of doing this now?

FWIW, I have been trying to port our app using Ivy to bazel following the example here and I am getting weird errors relating to certain custom elements not being defined (they are).

 error TS-998001: [ngtsc] 'sdk-label' is not a known element:
1. If 'sdk-label' is an Angular component, then verify that it is part of this module.
2. If 'sdk-label' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

3     <sdk-label [label]="label" [isRequired]="required"></sdk-label>
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  projects/draftkit/src/lib/input-field/input-with-label/input-with-label.component.ts:12:16
    12   templateUrl: "./input-with-label.component.html",
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component InputWithLabelComponent.

sdk-label is correctly defined and exported from a different NgModule which is in the deps of this NgModule

Is there a workaround for using IVY + Bazel while the examples here are updated?

@codebreach
Copy link

As per conversation on slack-

https://bazelbuild.slack.com/archives/CSACXKUBE/p1603786805015600

this was solved by adding "postinstall": "ngcc", to scripts in package.json

see https://github.com/bazelbuild/rules_nodejs/blob/stable/examples/angular/package.json#L76

@KrauseStefan
Copy link
Contributor

I just hit this issue with a component only compiled to ivy from another team.

There has been little activity on this issue for almost a year now, are there any plans for addressing this issue?

The current workaround seems to be putting an ANGULAR_PACKAGE file in the 3rd-party dependency, is a more solid solution planned?

For any one else finding this thread my workaround is adding the ANGULAR_PACKAGE using the npm postinstall hook.

    "postinstall": "echo '' > ./node_modules/@org/package/ANGULAR_PACKAGE;  ngcc",

@alexeagle alexeagle removed this from the Angular v10 milestone Dec 22, 2020
@github-actions github-actions bot removed the Can Close? We will close this in 30 days if there is no further activity label Jan 23, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity for 90 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

@github-actions github-actions bot added the Can Close? We will close this in 30 days if there is no further activity label Apr 27, 2021
@jbedard jbedard closed this as completed Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can Close? We will close this in 30 days if there is no further activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants