unplugin / unplugin-icons

🤹 Access thousands of icons as components on-demand universally.
https://www.npmjs.com/package/unplugin-icons
MIT License
3.65k stars 131 forks source link

chore: expose online links for examples in StackBlitz #315

Closed userquin closed 7 months ago

userquin commented 8 months ago

@antfu I just added Astro example as POC, feel free to close it... This can be used for reproduction in issues:

To test examples in this PR in SB (changed links to use my branch instead main):

stackblitz[bot] commented 8 months ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

userquin commented 8 months ago

We should update all examples to use type module...

Qwik is not working (I can install dependencies downgrading eslint to 8.45.0 and updating qwik eslint to 1.2.11). Once installed dependendencies, runtime fails local-pkg requesting @svgx/core, if added as dev dependency then this another error (you can check it here in SB):

[vite] Error when evaluating SSR module /src/app.tsx: failed to import "~icons/ri/flashlight-line.jsx"
|- TypeError: Failed to resolve module specifier 'hast-util-from-html'
    at eval (eval at toHast (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/@svgx/core/lib/esm/index.js), <anonymous>:1:1)
    at toHast (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/@svgx/core/lib/esm/index.js:36:32)
    at toEstree (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/@svgx/core/lib/esm/index.js:44:24)
    at toEstreeComponent (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/@svgx/core/lib/esm/index.js:111:26)
    at toJsxComponent (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/@svgx/core/lib/esm/index.js:73:35)
    at QwikCompiler (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/unplugin-icons/dist/chunk-FFGDY6HT.mjs:149:15)
    at async Context.load (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/unplugin-icons/dist/chunk-FFGDY6HT.mjs:409:20)
    at async Object.load (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/vite/dist/node/chunks/dep-df561101.js:44306:32)
    at async loadAndTransform (file:///home/projects/unplugin-unplugin-icons-mtktp4/node_modules/vite/dist/node/chunks/dep-df561101.js:54930:24)
userquin commented 8 months ago

There is no way, added the failing module and a few more but qwik example still failing in SB (on my local works), check this repo https://stackblitz.com/edit/unplugin-unplugin-icons-h3iqbu?file=package.json and my previous comment here

Dependencies added to the same example here:

    "estree-util-to-js": "^1.2.0",
    "hast-util-to-estree": "^2.3.3",
    "hast-util-from-html": "^1.0.2",
patak-dev commented 8 months ago

@userquin I think you could use QwikCity until the SB issue is fixed. Would you create an issue on https://github.com/stackblitz/webcontainer-core with the Qwik repro that is failing?

userquin commented 8 months ago

uhmm, missing iconify ri dependency...

EDIT: it is there, plugin with auto install seems to work in SB

userquin commented 8 months ago

@userquin I think you could use QwikCity until the SB issue is fixed.

Same error with QwikCity: https://stackblitz.com/edit/qwik-starter-naqri5

userquin commented 8 months ago

@antfu It seems a problem with eval + import in @svgx/core package: I've it working on this SB repo using @svgr/core + @svgr/plugin-jsx (like jsx compiler), check the custom icon compiler in the vite config file