-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Installing angular pwa dosen't work #774
Comments
Thanks @ahmedhmf. You're correct that most of the files are set up correctly by running I created a sample repo that has the service worker files set up, builds the service worker through an inline vite plugin in the vite.config.ts. I did separate commits for the changes. https://github.com/brandonroberts/analog-service-worker We can build this support into the plugin itself. |
I wonder if we can use the nx ng-add generator with some custom options & the inline plugin you created for this @brandonroberts to support this through the AnalogJs plugin |
Yea, I think it might be better to create our own |
any known workaround or updates on this? |
Yes, you can see the changes in the commits in this repo |
Please provide the environment you discovered this bug in.
local build
with angular v17.0.0 and analogjs v0.2.0
Which area/package is the issue in?
Don't know / other
Description
After installing @angular/pwa and adding it to the project files are created correctly as per the angular documentation. when building and trying to start the app. we get an error
Service worker registration failed with: DOMException: Failed to register a ServiceWorker for scope ('http://localhost:3000/') with script ('http://localhost:3000/ngsw-worker.js'): The script has an unsupported MIME type ('text/html').
After investigating the problem I thought it was just wrong configuration path for the path of the server worker.
Please provide the exception or error you saw
Other information
After Investigating for sometime. As you know in our sources we have only the configuration for the service worker and angular generates the js file when building. Maybe my interpretation of this problem will help and it is that the service worker js file should be generated and added to the public folder and as angular don't have a public folder it is not generated there and I think that is the problem. The problem was found first in Angular Hub project https://github.com/angular-sanctuary/angular-hub if this will hel to investigate. I am also available to support if any help is needed :D
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: