bug(package): Unannounced breaking change: new package structure requires exports
field support
#25305
Closed
1 task done
Labels
needs triage
This issue needs to be triaged by the team
Is this a regression?
The previous version in which this bug was not present was
13.3.9
Description
Until v13.x,
@angular/material
shipped with one top levelpackage.json
, as well as individualpackage.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 levelpackage.json
exposes path resolutions for each version of each component via a series ofexports
entries. As a result, any consumer that does not understand or respect theexports
field in the top levelpackage.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:
Note that the Webpack config uses
resolve.exportsFields: []
to ignore theexports
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 theexports
field is ignored / unsupported.Environment
The text was updated successfully, but these errors were encountered: