-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Yarn PnP cannot import bs-datepicker.css #6449
Comments
salmoro
pushed a commit
to salmoro/ngx-bootstrap
that referenced
this issue
Apr 5, 2022
This PR enables importing "bs-datepicker.css" file when using Yarn with PnP. When declared, the "exports" field in a package.json is meant to conceal and exclude all unspecified files or directories. Until now the exclusion of "bs-datepicker.css" wasn't an apparent issue because no other package manager/strategy is able to enforce disallowing importing files not specified in the "exports" field but Yarn with PnP enforces it. https://nodejs.org/api/packages.html#packages_exports https://github.com/jkrems/proposal-pkg-exports/ https://angular.io/guide/creating-libraries#managing-assets-in-a-library fixes valor-software#6449
valorkin
pushed a commit
that referenced
this issue
Jun 16, 2022
This PR enables importing "bs-datepicker.css" file when using Yarn with PnP. When declared, the "exports" field in a package.json is meant to conceal and exclude all unspecified files or directories. Until now the exclusion of "bs-datepicker.css" wasn't an apparent issue because no other package manager/strategy is able to enforce disallowing importing files not specified in the "exports" field but Yarn with PnP enforces it. https://nodejs.org/api/packages.html#packages_exports https://github.com/jkrems/proposal-pkg-exports/ https://angular.io/guide/creating-libraries#managing-assets-in-a-library fixes #6449 Co-authored-by: Shlomo Morosow <smorosow@Viventium.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On a working Angular codebase which has a less import statement
@import (less) 'ngx-bootstrap/datepicker/bs-datepicker.css';
, if I switch to using Yarn PNP, webpack loader throws an error that it cannot find the file.If I edit the generated "package.json" of ngx-boostrap and add
"./datepicker/bs-datepicker.css": "./datepicker/bs-datepicker.css"
to the "exports" property, the error goes away and seems to be resolved.This is probably not a bug in Yarn itself as the Node docs (and the original proposal) seem to suggest that the "exports" field is used to conceal internals and until Yarn PNP (using the conventional 'node_modules" folder) there was just no simple way to enforce it.:
https://nodejs.org/api/packages.html#packages_exports
https://github.com/jkrems/proposal-pkg-exports/
The text was updated successfully, but these errors were encountered: