You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the reload function does too little, it only reloads the Inline-Config, nothing more. But the configuration is not all defined in the Inline-Config, they may be configured in different modules.
It is not ideal to re-run the whole life cycle when a reload occurs, but the modules are not even aware that a reload has occurred, which leads to the modules not being able to respond to the reload as they should.
wxt={
config,
hooks,hook: hooks.hook.bind(hooks),getlogger(){returnconfig.logger;},asyncreloadConfig(){wxt.config=awaitresolveConfig(inlineConfig,command);},
pm,
builder,
server
};
For example, the i18n module requires the default-locale configuration. However, when reloading, if default-locale is not configured through Inline-Config, there will be no default-locale configuration in the reloaded configuration, and it will fail in the prepare:types phase.
Summary:
Modules are not aware of reloading and cannot respond to reloading
What are the alternatives?
My idea is to add a series of hooks about reload (reload:before and others) so that the module can know that a reload is happening and respond correctly when the reload occurs to avoid some problems brought by HMR.
In this way, no need to rerun the entire life cycle, only the pre-defined functions need to be executed.
The following is my temporary solution, reconfigured in a relatively early hook.However, this is not a proper or legitimate solution.
The reason I configure the manifest in a separate module is that when a manifest entry is configured that is not supported by the browser, warnings will be given, and I don't want those warnings.
Seems like the ideal solution to me, did you see something in the code that would make you think this?
No. I think this because I see that you only do simple things in the reload step, and I think you may be considering performance or other issues. If there is no problem, then that would be best.
Feature Request
Currently, the reload function does too little, it only reloads the Inline-Config, nothing more. But the configuration is not all defined in the Inline-Config, they may be configured in different modules.
It is not ideal to re-run the whole life cycle when a reload occurs, but the modules are not even aware that a reload has occurred, which leads to the modules not being able to respond to the reload as they should.
Edit: Somewhat similar to #939
For example, the i18n module requires the
default-locale
configuration. However, when reloading, ifdefault-locale
is not configured through Inline-Config, there will be nodefault-locale
configuration in the reloaded configuration, and it will fail in theprepare:types
phase.Summary:
What are the alternatives?
My idea is to add a series of hooks about reload (reload:before and others) so that the module can know that a reload is happening and respond correctly when the reload occurs to avoid some problems brought by HMR.
In this way, no need to rerun the entire life cycle, only the pre-defined functions need to be executed.
The following is my temporary solution, reconfigured in a relatively early hook.However, this is not a proper or legitimate solution.
The reason I configure the manifest in a separate module is that when a manifest entry is configured that is not supported by the browser, warnings will be given, and I don't want those warnings.
The text was updated successfully, but these errors were encountered: