-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[PWA] ngsw.json assetGroups are blank in Angular 12 (cause 504 error) #20894
Comments
I am also having exact this same issue with service worker. |
Experiencing same issue, just tried with a band new application and issue is producing .This is high priory issue and must be fixed quickly. Many thanks |
Its need an urgent action to fix. Facing same issue with NG-12. |
Facing the same issue and looking for solution as soon as possible. Thanks |
I am facing this issue with service worker, can you please look into it urgently, Thank you |
I am facing this issue with a service worker, please fix it on urgently base, many Thanks |
i am also facing same issue, need solution urgently |
I am same issue, just tried with a band new application and issue is producing .Can you please look into it urgently, |
Its need an urgent action to fix. Facing same issue |
Facing Same Issue |
yes exactly facing same issue, need urgently solution on it. thanks. |
Facing same issue and looking for it urgent solution. |
I can confirm this happens in a new CLI app with v12.0.1. It sounds like something has changed in the CLI that prevents the SW config script to detect any dist files. (More investigation is needed to determine the exact cause.) The minimal reproduction is: ng new test-app --defaults
cd test-app
ng add @angular/pwa
ng build
// Observe that the `assetGroups > urls` arrays are empty. As a temporary work-around, you can create an npm script that manually runs the SW configuration script and call it after you build for production. The script will look something like For example, for the minimal reproduction shown above, it would look like: // package.json
// ...
"scripts": {
// ...
"build-sw": "ngsw-config dist/test-app ngsw-config.json", |
…config on Windows Since angular#20518, the generation of the ServiceWorker configuration has been broken on Windows. The reason is the use of `path.posix.*` methods on non-POSIX paths, resulting in broken paths. I.e. we ended up with something like the following: ```js path.posix.relative('C:\\foo', 'C:\\foo\\bar/baz'); // Expected result: `bar/baz` // Actual result: `../C:\\foo\\bar/baz` ``` This caused the config generator to fail to find any files and thus fail to populate the config with cacheable assets. This commit fixes it by using platform-specific `path.*` methods and manually normalizng the path separators before returning the results. Fixes angular#20894
…config on Windows Since angular#20518, the generation of the ServiceWorker configuration has been broken on Windows. The reason is the use of `path.posix.*` methods on non-POSIX paths, resulting in broken paths. I.e. we ended up with something like the following: ```js path.posix.relative('C:\\foo', 'C:\\foo\\bar/baz'); // Expected result: `bar/baz` // Actual result: `../C:\\foo\\bar/baz` ``` This caused the config generator to fail to find any files and thus fail to populate the config with cacheable assets. This commit fixes this by using platform-specific `path.*` methods for path manipulation and manually normalizing the path separators before returning the results. Fixes angular#20894
BTW, this issue only affects Windows 😟 |
…config on Windows Since angular#20518, the generation of the ServiceWorker configuration has been broken on Windows. The reason is the use of `path.posix.*` methods on non-POSIX paths, resulting in broken paths. I.e. we ended up with something like the following: ```js path.posix.relative('C:\\foo', 'C:\\foo\\bar/baz'); // Expected result: `bar/baz` // Actual result: `../C:\\foo\\bar/baz` ``` This caused the config generator to fail to find any files and thus fail to populate the config with cacheable assets. This commit fixes this by using platform-specific `path.*` methods for path manipulation and manually normalizing the path separators before returning the results. Fixes angular#20894
…config on Windows Since #20518, the generation of the ServiceWorker configuration has been broken on Windows. The reason is the use of `path.posix.*` methods on non-POSIX paths, resulting in broken paths. I.e. we ended up with something like the following: ```js path.posix.relative('C:\\foo', 'C:\\foo\\bar/baz'); // Expected result: `bar/baz` // Actual result: `../C:\\foo\\bar/baz` ``` This caused the config generator to fail to find any files and thus fail to populate the config with cacheable assets. This commit fixes this by using platform-specific `path.*` methods for path manipulation and manually normalizing the path separators before returning the results. Fixes #20894
…config on Windows Since #20518, the generation of the ServiceWorker configuration has been broken on Windows. The reason is the use of `path.posix.*` methods on non-POSIX paths, resulting in broken paths. I.e. we ended up with something like the following: ```js path.posix.relative('C:\\foo', 'C:\\foo\\bar/baz'); // Expected result: `bar/baz` // Actual result: `../C:\\foo\\bar/baz` ``` This caused the config generator to fail to find any files and thus fail to populate the config with cacheable assets. This commit fixes this by using platform-specific `path.*` methods for path manipulation and manually normalizing the path separators before returning the results. Fixes #20894 (cherry picked from commit d1953bf)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report
Affected Package
The issue is caused by package @angular/...."@angular/service-worker"
: "^12.0.0"Is this a regression?
Description
http-server
(mentioned in the above tutorial)Minimal Reproduction
Exception or Error
Your Environment
Angular Version:
Anything else relevant?
What I notice is:
ngsw.json
, theurls
in bothapp
andassets
section insideassetGroups
are all blank (see the below image)urls
as the below image, the PWA worked perfectly. App can work in Offline modeThe text was updated successfully, but these errors were encountered: