-
Notifications
You must be signed in to change notification settings - Fork 173
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
Uncaught (in promise) ReferenceError: window is not defined #883
Comments
Another issue is that some styles are lost in prod build, but it probably can be workarounded. |
Tried to not set a Vite version in the |
Interesting error, thanks for reporting, will look into this soon! |
It looks like the might be importing files related to |
I have encountered this error, which is actually an error of vite dynamic import failure. Let me guess, you used dynamic import in the background. FYI - Background does not support the use of dynamic import. w3c/webextensions#212 |
Even for empty But I've found how to work around this issue: remove Probably something is wrong there when the entrypoint is declared as a module. |
@amal In the repro zip you submitted, simply commenting out |
@amal Also, according to @aiktb's theory, the
|
@amal Sorry, I was misread your message. If you keep Dynamic import isn't support in the background script, it might be better to use synchronous implementations instead. |
@1natsu172, thank you. Yes, I plan to use only the synchronous implementation. |
Yeah, so this is one of the reasons I don't recommend using a i18n library over the builtin APIs... You end up either having to either fetch JSON files asynchronously or include all your translations in each individual entrypoint bundle :/ You do get some benefits, like being able to switch languages, but other than that... 🤷 For larger, more complex apps, it probably make sense to use a library. I swear one day I'll finish #758... |
So just to clearify, the problem was dynamic imports in a background marked as Solutions:
If we need to keep this open, feel free to reopen! |
Right. I've checked that using dynamic imports in the background(with This is a trade-off.
|
Describe the bug
Tried with 0.19.2 and 0.18.15.
This error persists both in dev and prod builds.
Reproduction
Archive.zip
Steps to reproduce
Just run the extension form attached archive and see.
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: