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

bug(package): Unannounced breaking change: new package structure requires exports field support #25305

Closed
1 task done
thw0rted opened this issue Jul 19, 2022 · 4 comments
Closed
1 task done
Assignees
Labels
needs triage This issue needs to be triaged by the team

Comments

@thw0rted
Copy link

thw0rted commented Jul 19, 2022

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

13.3.9

Description

Until v13.x, @angular/material shipped with one top level package.json, as well as individual package.json files for each component, e.g. @angular/material/button/package.json. As part of the 14.0 update, these individual component-level files were removed. Instead, the top level package.json exposes path resolutions for each version of each component via a series of exports entries. As a result, any consumer that does not understand or respect the exports field in the top level package.json becomes incompatible with this library.

Reproduction

Steps to reproduce:
Clone this repro and execute npm run start. The build should be successful.

Clone the same thing updated to v14 of Angular and Material, and run the same command. You will see:

ERROR in ./src/app/app.module.ts 29:17-52
Module not found: Error: Can't resolve '@angular/material/button' in 'path\to\src\app'
resolve '@angular/material/button' in 'path\to\src\app'

Note that the Webpack config uses resolve.exportsFields: [] to ignore the exports field.

Expected Behavior

Consumers that do not understand the exports field should still be able to use the library.

(If the files are not restored, and exports-field support is required going forward, this is a breaking change and should be documented as such in the change log, dating back to 14.0.0.)

Actual Behavior

Consumers that don't understand, or intentionally ignore, the exports field can no longer use the library.

Ignoring the exports field is the recommended solution suggested by Webpack, when using a library that fails to explicitly export a resource you need to consume. I am stuck with such a library, I've had an open issue with them to fix it for over a year and I'm not happy about it, but there is literally nothing else I can do. Still, this is the first time I've run into a library that does not work at all when the exports field is ignored / unsupported.

Environment

  • Angular: 14.0.6
  • CDK/Material: 14.0.5
  • Browser(s): N/A
  • Operating System (e.g. Windows, macOS, Ubuntu): Win10
@thw0rted thw0rted added the needs triage This issue needs to be triaged by the team label Jul 19, 2022
@zarend zarend removed the needs triage This issue needs to be triaged by the team label Jul 26, 2022
@jelbourn jelbourn added the needs triage This issue needs to be triaged by the team label Sep 13, 2022
@crisbeto crisbeto self-assigned this May 3, 2023
@crisbeto
Copy link
Member

crisbeto commented May 3, 2023

Closing since this is handled at the APF level that we don't have control over.

@crisbeto crisbeto closed this as completed May 3, 2023
@thw0rted
Copy link
Author

thw0rted commented May 7, 2023

@crisbeto What's APF? As I said in the OP, if Angular is "stuck" with a design that depends on the use of the exports field, that information should at least be present in the documentation.

@crisbeto
Copy link
Member

crisbeto commented May 8, 2023

APF is the Angular Package Format: https://angular.io/guide/angular-package-format.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

4 participants