Closed aklinker1 closed 5 months ago
For the purpose of this issue, I'm going to just do a basic reload. There's lots of complications around this if I were to try and do a hot reload, so for now, I'm skipping that.
I also noticed that the extension doesn't reload properly when changing public files, localization included. So I'll make a small fix to fix both these issues together.
Basic reloading added in v0.18.8
. I'm working on a wrapper around the i18n APIs to make it easier, and plan on adding HMR to it: https://github.com/wxt-dev/wxt/pull/758
If you have any feedback around the API, let me know!
Feature Request
When saving a change to any
public/_locales/*/messages.json
, the extension should either do a full reload, or it should support HMR somehow. It also needs to support any file pattern, so this also supports the changes in https://github.com/wxt-dev/wxt/pull/343.A couple of ways to do this:
browser.i18n
API. It waits for messages from the dev server, caches the latest translations, and pulls the latest localization from the web.The other problem, is how do I know which locale to pull text from.Use@@ui_locale
import.meta.hot
API on the client side to setup changes? Once again, no idea how this would work.I'm gonna go with option 1, using the web-socket to notify when code changes and cache the latest values client side. For UI's, we can add framework-specific utils around automatically re-rendering when the text changes. I don't think there's a single-solution-fits-all available here. Until those custom utils are implemented, which likely won't be in the first PR, you'll just have to refresh the HTML page.
Is your feature request related to a bug?
N/A
What are the alternatives?
Stopping the dev command and restarting it.
Additional context