Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to enable PWA on React + AEM SPA? (404 error)

Avatar

Avatar
Level 1
carbenav
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
carbenav
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
carbenav
Level 1

05-04-2020

I am following this tutorial: https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-spa-wknd-tutorial-develop/...

and haven't found a way to install a service worker. 

 

I did try by:

  1. Creating a service-worker.js file in the react-app/scr folder.
  2. Importing and registering it on the index.js file
    [ So far, just as any regular react app]
  3. Adding the reference to service-worker file in the clientlib.config.js file in the libs:assets:js array
    libs: {
        ...
        assets: {
        js: [
           "build/static/**/*.js",
           "build/service-worker.js"
        ],
     
     
    That got the service-worker.js from the react-app/build to the ui.apps/... /clientlibs/react-app/js/service-worker.js
    but when running the aem instance I got an 404 error on the service-worker.js file request.
     
    Screen Shot 2020-04-06 at 12.43.33 AM.png
View Entire Topic

Avatar

Avatar
Seeker
MVP
Suraj_Kamdi
MVP

Likes

146 likes

Total Posts

157 posts

Correct Reply

41 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Springboard
Validate 1
View profile

Avatar
Seeker
MVP
Suraj_Kamdi
MVP

Likes

146 likes

Total Posts

157 posts

Correct Reply

41 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Springboard
Validate 1
View profile
Suraj_Kamdi
MVP

07-04-2020