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

Icons Preset Node Loader does not work when using Yarn PnP #3667

Open
4 tasks done
FWest98 opened this issue Mar 28, 2024 · 5 comments
Open
4 tasks done

Icons Preset Node Loader does not work when using Yarn PnP #3667

FWest98 opened this issue Mar 28, 2024 · 5 comments
Labels
enhancement New feature or request pr welcome

Comments

@FWest98
Copy link

FWest98 commented Mar 28, 2024

UnoCSS version

0.58.8

Describe the bug

When using Yarn PnP, the icons preset does not pick up on any Iconify dependencies being present. I suspect this is caused by the "Node Loader" deferring to a filesystem lookup - this fails because when using PnP: there is no node_modules folder as all the dependencies are zipped and made available on demand when importing a dependency.

I did find a workaround by modifying the icons preset configuration:

presetIcons({
    collections: {
        "material-symbols": () => import("@iconify-json/material-symbols/icons.json").then(i => i.default)
    }
})

System Info

No response

Validations

@antfu
Copy link
Member

antfu commented Mar 28, 2024

I am sorry, but I am not interested in supporting Yarn PnP.

@antfu antfu closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2024
@FWest98
Copy link
Author

FWest98 commented Mar 28, 2024

Then it would be good to mention this clearly in the documentation. The docs do include yarn example commands, and Yarn PnP has already become the default for new projects. This is related to #3566 as well.

@antfu
Copy link
Member

antfu commented Mar 28, 2024

That's interesting. I didn't know they are doing PnP by default now, which is also kind of sad because it requires the ecosystem to have special handling for it. In that case, I am open to contributions if the implementation is not too difficult. But supposedly, the code to fix it is not in this repo but somewhere down the line, like @iconify/utils or so.

Reopen to keep track of it.

@antfu antfu reopened this Mar 28, 2024
@antfu antfu added enhancement New feature or request pr welcome labels Mar 28, 2024
@cyberalien
Copy link
Contributor

cyberalien commented Mar 29, 2024

Confirmed and trying to debug it...

When trying to debug it, found a related issue:

Installing @iconify-json/mdi...
Unknown Syntax Error: Unsupported option name ("--prefer-offline").

$ yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--mode #0] ...
[@iconify-loader] Failed to install @iconify-json/mdi
Error: Command failed with exit code 1: yarn add -D --prefer-offline @iconify-json/mdi

Triggered by installPackage from @antfu/install-pkg package.

edit: option --prefer-offline does not exist in Yarn 3.6.0, so error is correct. Yarn detection is broken in @antfu/install-pkg

@cyberalien
Copy link
Contributor

Figured it out. Error is caused by resolvePath from mlly package failing to resolve @iconify-json/material-symbols/icons.json, even though package is installed.

So 2 unrelated issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pr welcome
Projects
None yet
Development

No branches or pull requests

3 participants