astro-icon
astro-icon copied to clipboard
Make integration work without manually restarting the server.
What version of astro-icon
are you using?
No response
Astro Info
Astro v4.0.8
Node v18.18.0
System Linux (x64)
Package Manager pnpm
Output static
Adapter none
Integrations astro-icon
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When I update options in the icon integration in the astro.config.*, the changes are not detected despite the server restarting unless I restart the server manually.
What's the expected result?
I expect the changes to be detected without manually restarting the server, since the server automatically starts whenever there is a change in the astro configuration.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/astro-example-with-astro-icon-integration
I have the same problem. When I change an SVG icon, the dev-debugger reports its awareness that the file changed...but makes no effort to re-compile anything. I have to completely stop and restart the VSCode dev/debug session to have the icons recompile.
I am suspicious this is related to Astro Icon reporting "No Icons detected" when the debug session starts. That is, if the Astro Icon integration isn't fully and properly aware that icons are "present", then perhaps it doesn't know how to signal a rebuild when one of them changes.
My setup...
"dependencies": {
"@astro-community/astro-embed-youtube": "^0.4.1",
"@astrojs/mdx": "^1.1.3",
"@astrojs/rss": "^2.4.3",
"@astrojs/sitemap": "^1.3.2",
"@sanity/astro": "2.1.1",
"@sanity/client": "^6.4.12",
"@sanity/image-url": "^1.0.2",
"astro": "^3.4.0",
"astro-icon": "^1.0.1",
"astro-portabletext": "^0.9.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sanity": "*"
}
I am using pnpm
and node 18.18.0.
I believe this will be as simple as moving this line inside of the Vite plugin rather than having it outside of the closure. That way the collections are reloaded every time the plugin is instantiated.
https://github.com/natemoo-re/astro-icon/blob/d9bb81dee682229a0f10d3d772e9894bd43fec81/packages/core/src/vite-plugin-astro-icon.ts#L17