[v1] Unable to locate @iconify-json/* packages when installed with Bun
cbasje opened this issue · comments
When I run my SSR site with Bun (dev, build, etc.), the astro-icon
package is unable to locate @iconify-json/*
packages. It gives the following error, even though the ph set is installed:
error: Unable to locate the "ph" icon set!
at init (:29:16)
at render (:35:18)
at render (:337:22)
at processTicksAndRejections (:61:77)
error Unable to locate the "ph" icon set!
Hint:
It looks like the "ph" set was not loaded.
Did you install the "@iconify-json/ph" dependency?
When installing my dependencies with npm install
, it all works perfectly. I am not sure if this is an existing issue with Bun but I just wanted to mention it.
Same problem? Any solutions?
I am also experiencing this using pnpm. In dev everything is fine, but astro build
fails with a similar error. Also confirmed the workaround by installing the iconify
packages as dependencies
Looking into this further I noticed it's not necessarily how the deps are declared in package.json but how they are installed and set in the corresponding lockfile.
Thanks for the report! I would say that this is an issue that should be reported to Bun, but it's unlikely that their installation strategy will be updated to match npm/others.
In v1, we have to detect which @iconify-json
packages you've installed. I haven't looked into how to do that with Bun yet, but every other package manager has a list (ls)
command that enables this. Does Bun have something similar?
Hey @natemoo-re. It does! https://bun.sh/docs/cli/pm will probably be the right place to take a look. It's basically just bun pm ls
.
@josefaidt what exactly do you mean by installing them as dependencies? Here's my package.json
{
"name": "app-v1",
"version": "0.0.1",
"dependencies": {
"@astrojs/check": "^0.3.4",
"@astrojs/tailwind": "^5.0.4",
"@astrojs/vue": "^4.0.5",
"@fontsource/ibm-plex-mono": "^5.0.8",
"@fontsource/outfit": "^5.0.8",
"@iconify-json/line-md": "^1.1.33",
"astro": "^4.0.7",
"astro-icon": "1.0.0",
"clsx": "^2.0.0",
"tailwindcss": "^3.4.0",
"typescript": "^5.3.3",
"vue": "^3.3.13"
},
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"type": "module",
"devDependencies": {
"@iconify/vue": "^4.1.1",
"prettier": "3.1.1"
}
}
@leithonenglish if I have @iconify-json/*
packages installed as devDependency the build fails (but dev is fine), here's what I currently have https://github.com/josefaidt/josef.dev/blob/v3/package.json#L27-L28
if I move these packages to dependencies
and install, the build succeeds.
if I clone this repo and log out the data
read here, I see something a bit odd
{
data: [
{
name: 'my-project',
version: '3.0.0-next.0',
path: '/path/to/my-project',
private: true,
unsavedDependencies: [Object]
}
]
}
upon further investigation this must be something unique with pnpm when NODE_ENV is set to production. I'll file something separate