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

Make integration work without manually restarting the server. #181

Closed
kenedyolisi opened this issue Jan 2, 2024 · 2 comments · Fixed by #203
Closed

Make integration work without manually restarting the server. #181

kenedyolisi opened this issue Jan 2, 2024 · 2 comments · Fixed by #203

Comments

@kenedyolisi
Copy link

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

@kenedyolisi kenedyolisi changed the title Make integration work even after updating astro configuration. Make integration work without manually restating the server. Jan 2, 2024
@kenedyolisi kenedyolisi changed the title Make integration work without manually restating the server. Make integration work without manually restarting the server. Jan 2, 2024
@brentarias
Copy link

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.

@natemoo-re
Copy link
Owner

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.

let collections: AstroIconCollectionMap | undefined;

natemoo-re added a commit that referenced this issue Feb 2, 2024
natemoo-re added a commit that referenced this issue Feb 7, 2024
* fix(#181): avoid closure

* chore: add changeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants