Trying to make payload application pwa.

default discord avatar
anisulislampranto
2 months ago
5

So i am trying to make my payload app pwa. So as far as i know i have to do some modification from public folders manifest.json file. But in payload application we don't have that. But from ai help i got to know about adding public folder.



but it is not working as expected. if we check the browser application tab we can see that it is not getting the manifest.json file.

  • default discord avatar
    paulpopus
    2 months ago

    What are you trying to achieve with payload app as pwa?


    AFAIK I haven't seen anyone do this before (then again I don't see many pwas these days) so you're treading pretty unknown grounds

  • default discord avatar
    anisulislampranto
    2 months ago

    yeah. that's true. but it is possible right ? i mean making it pwa.



    So this application is being served as front end as well. i am using custom routes and components so that's why it will be a webapp for the users and for flexibility i am trying to make it pwa.

  • discord user avatar
    tylandavis
    Payload Team
    2 months ago

    I'm not super familiar with building PWAs, but I imagine you may need to modify the

    index.html

    file that's served after building to include a link to the

    manifest.json

    file.

  • default discord avatar
    paulpopus
    2 months ago

    Yeah it's possible, you will want to modify the webpack configuration, and by default Payload doesn't serve any

    public

    folder



    for the latter you wanna update the build step of copyfiles


    "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",


    you see its copying all those file extensions, add one for your .json or simply create a new step to copy a whole folder into dist too



    I don't think you need to modify the webpack config actually

  • default discord avatar
    generator101
    2 months ago

    Are you trying to make an offline application?

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.