-
Notifications
You must be signed in to change notification settings - Fork 57
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
[Wasm] PWA service-worker.js : SyntaxError: Unexpected token 'export' #659
Comments
Thanks for the report. Can you try updating to the latest |
Thanks for your prompt reply. The error in the service-worker.js that occurred while fetching the uno-config.js is solved. Thanks for the hint! Updating the package to the (currently) latest dev version (8.0.0-dev.65) did not solve the issue either. |
Thanks for the update. This looks similar to unoplatform/uno#10929, where some files specified in the offline list cannot be loaded causing the worker to fail to register.
|
Should I try not using the VS22 template and try adding the manifest manually which proved to work when there was no VS22 template for PWAs? |
@asadullahrifat89 you won't be able to fix this using a custom configuration. This is related to files not being able to be downloaded properly and causing the worker to not be installed properly. |
Alright, do you have any fixes planned that might be around anytime soon? |
@jeromelaban thanks for the fix, I tried on my end and indeed the caching issue is now gone and the console looks clean. |
Thanks for trying it out. Indeed, the installation issue is not the same. I wonder if this is related to the "scope" field in your manifest. Could you set it to |
I tried to change the scope as you mentioned but it didn't help I guess in my previous playground I did copied the service-worker in the "package" in one of the many trials to fix the issue_ I then moved the deployment straight to the website root: Any idea why the service worker fails if is placed in a sub directory? |
Thanks for the update. The Now with regards to the sub path, this means that you may also need to change this, so that the service worker gets registered at the right location. Still, there may be additional issues there, so let us know if this helps. |
Hi @jeromelaban, I tried dev-77 and after manually removing the "invalid file" I'm in the same situation: compiled without compiled with /scewo/figma/ compiled with ./scewo/figma2/ Interestingly, on Firefox none of the above works |
@jeromelaban I saw some console errors - which I believe they are related - as I'm trying to make my app a PWA:
('XXX' as a place holder for the real domiain) Next I updated to latest Not sure if relevant by I also have this in my project file What am I doing wrong? |
@igiona @DierkDroth thanks for the update. These are not related to the original issue here, so let's track it in #662. |
Current behavior
A freshly PWA WASM application created using VS22 template, creates the necessary PWA files, but while executing I get the following error on the browser (chrome 108.0.5359.125 (Official Build) (64-bit) (cohort: Stable)):
As result, the under "installability" the browser reports an error.
Expected behavior
The service-worker is loaded successfully, and the browser can install the application.
How to reproduce it (as minimally and precisely as possible)
Create a fresh Uno WASM with the PWA option enabled.
Load the published output to a web server and check the Chrome dev-tools.
An example can be found here: https://www.immo-electronics.ch/scewo/figma/
Uno Platform Check v1.10.0.0
Workaround
The issue seems to come from the "export { config }" line in uno-config.js, which can't be "eval" at runtime within the service-worker.js .
I tried to C&P the "offline_files" list directly into the service-work.js, but I got the following error:
Uncaught (in promise) TypeError: Failed to execute 'addAll' on 'Cache': Request failed
The same error can be also seen in this Uno based website: https://nuget.info/packages which appears not to have the "export" statement into the uno-config.js.
Works on UWP/WinUI
None
Environment
Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
NuGet package version(s)
Affected platforms
WebAssembly
IDE
Visual Studio 2022
IDE version
17.4.3
Relevant plugins
No response
Anything else we need to know?
No response
The text was updated successfully, but these errors were encountered: