How to Create a PWA With Next.js in 10 Minutes

Поделиться
HTML-код
  • Опубликовано: 25 янв 2025

Комментарии • 158

  • @avneesh0612
    @avneesh0612 3 года назад +44

    This was a very fun collab :D

    • @michelgerges2678
      @michelgerges2678 3 года назад +2

      That's awesome bro great JOB keep up the good work ;D

    • @MaxProgramming
      @MaxProgramming 3 года назад +2

      It's a huge achievement! Great work bro!

  • @journeyoftulsi
    @journeyoftulsi 2 года назад +10

    Bro not only explained but also showed other channels for explanation, you're a real saviour my man 🔥🔥

  • @czyzonrobinson6475
    @czyzonrobinson6475 2 года назад +44

    With Next.js 12 it will produce an error when building the next.config.js file, use these values instead:
    const nextConfig = {
    reactStrictMode: true,
    swcMinify: true,
    compiler: {
    removeConsole: process.env.NODE_ENV !== "development",
    },
    };
    const withPWA = require("next-pwa")({
    dest: "public",
    disable: process.env.NODE_ENV === "development",
    register: true,
    });
    module.exports = withPWA(nextConfig);

  • @internetdrew
    @internetdrew Год назад +3

    Thanks for the great video! Another way to do this is you have es7+ on Next.js 12:
    import withPWA from "next-pwa"; (do this at the top)
    const configWithPwa = withPWA({ dest: "public" , // other config options});
    export default configWithPwa(config);

  • @ai_coding
    @ai_coding Год назад

    ...dude u saved me from countless days of searching. Thank you!

  • @MaxProgramming
    @MaxProgramming 3 года назад +6

    Thank you very very much for including my video! Really appreciate that!
    P.S. You spelled my name correctly, heard it for the first time from a native English speaker 😁

    • @JamesQQuick
      @JamesQQuick  3 года назад +2

      Ahhhh amazing. So glad I did!!

  • @metamedian
    @metamedian 3 года назад +2

    Service workers only work with https, right? How do you do that for localhost development testing? I've been pulling my hair why my service workers aren't runnin after trying out a bunch of nextjs templates for PWA apps.

  • @ioanasbogdan
    @ioanasbogdan 3 года назад +2

    what are you using to get the autocomplete on terminal?

  • @nikoreva2078
    @nikoreva2078 3 года назад +1

    Hey, I can't get the PWA running. I followed all the steps from the tutorial, but the service worker isn't being registered correctly. Can someone maybe give me a tip on how to fix the problem?

  • @adarshrathi8265
    @adarshrathi8265 3 года назад +1

    bro, are you made multi form step. I want to make website clone of zety resume builder in which use multi step form.

  • @vishnudarshan4762
    @vishnudarshan4762 3 года назад +2

    Need a video on how you setup your terminal, please

  • @sofiap08
    @sofiap08 2 года назад +2

    If you are getting this error:
    "Please check your GenerateSW plugin configuration:
    [WebpackGenerateSW] 'reactStrictMode' property is not expected to be here. Did you mean property 'exclude'?"
    THIS WORKED FOR ME:
    Replace the code in your 'next.config.js' with the below:
    const withPWA = require('next-pwa')({
    dest: 'public'
    })
    module.exports = withPWA({
    // next.js config
    })

  • @angel-pu7su
    @angel-pu7su 2 года назад

    Thanks James and Avneesh for the great tutorial.

  • @EdgarLindo
    @EdgarLindo 2 года назад

    So, my run build was good without errors, but it didn't create the sw.js files.... I am also getting errors / warnings that GenerateSW has been called multiple times...

  • @z1982_
    @z1982_ 9 месяцев назад

    Hello thanks a lot. How can I write a service worker that will cache certain pages for offline support?

  • @intuitivamkt
    @intuitivamkt 3 года назад +1

    What camera re you using? I like the setup!

  • @thearong_5853
    @thearong_5853 3 года назад +2

    with typescript i got error and not working

    • @angel-pu7su
      @angel-pu7su 2 года назад

      Replace the code in your 'next.config.js' with the below:
      /** @type {import('next').NextConfig} */
      const withPWA = require("next-pwa");
      module.exports = withPWA({
      reactStrictMode: true,
      pwa: {
      dest: "public",
      register: true,
      skipWaiting: true,
      disable: process.env.NODE_ENV === "development",
      },
      });
      Copy and paste exactly as is.

  • @blazi_0
    @blazi_0 2 года назад +2

    guys just install old version of next-pwa the new version not working with nextjs new update yet:
    npm install next-pwa@5.5.4

  • @webloom7345
    @webloom7345 3 года назад +1

    well done James very nice video but at 12:15 , sounds a noise like on/off

  • @davidbobadilla2323
    @davidbobadilla2323 2 года назад

    Is that a Superantural poster?

  • @hectordnc
    @hectordnc Год назад

    Thank you. But I have a question. When my application is in 'src/app' and not in 'pages/' then the pwa doesn't work. How to solve it?

  • @krystianwojtowicz9305
    @krystianwojtowicz9305 9 месяцев назад

    how to cache pages for when off line?

  • @mustadirmahmood6271
    @mustadirmahmood6271 9 месяцев назад

    The solution is for pages router. Are there any similar contents available for app router?

  • @chiranthmjain7940
    @chiranthmjain7940 Год назад

    is there any possibility to remove ellipsis from PWA MicrosoftEdge?

  • @preciousegwuenu2938
    @preciousegwuenu2938 Год назад

    Superb! This helped me although since I use nextjs app router, I had to use the layout.js and not _document.tsx and I also had to structure the next.js config in some type of way for it to work. also guys, you might want to add screenshots in your manifest.json file.

  • @MiaUniversity
    @MiaUniversity 7 месяцев назад

    WOW, THIS TUTORIAL IS REALLY WORKS!

  • @aerotheory
    @aerotheory 3 года назад +1

    I enjoyed watching this segment on your new camera. Any chance of mentioning what camera you used? I need some closure...

    • @JamesQQuick
      @JamesQQuick  3 года назад +1

      Haha it’s the Sony a6400 with sigma 1.4 16mm lens :)

    • @tagecc5280
      @tagecc5280 3 года назад

      @@JamesQQuick nice

  • @IvoTsochev
    @IvoTsochev 3 года назад +2

    This was an amazing video, James! I'll try it out, thank you

  • @imvolkankaban
    @imvolkankaban 3 года назад +2

    How about a website with bootstrap 5, if can't start from scratch?

    • @JamesQQuick
      @JamesQQuick  3 года назад

      Ah good idea. I haven’t used bootstrap in a few years now

  • @felixmenendez
    @felixmenendez 3 года назад +1

    This is great. Is it possible to create a sort of installer file to install the app without using de browser?

    • @JamesQQuick
      @JamesQQuick  3 года назад

      Not that I know of but maybe…?

  • @Chems-eddineSediri
    @Chems-eddineSediri 11 месяцев назад

    i did exactly the sane thing. no errors, but the icon on the url doesnt appear any ideas pls?

  • @eronmonseleoaikhina5832
    @eronmonseleoaikhina5832 2 года назад

    which extension is your visual studio using @James Q Quick

  • @suleman234
    @suleman234 3 года назад

    james i have a question do u like cobalt 2 more or midnight synth ?????? pls answer

  • @paul-gerhardsiegel7065
    @paul-gerhardsiegel7065 9 месяцев назад

    With Next.js 14 "next.config.js" now is "next.config.mjs".
    I removed the latter and exchanged it with a next.config.js as follows:
    const withPWA = require('next-pwa')({
    dest: 'public',
    register: true,
    skipWaiting: true,
    disable: process.env.NODE_ENV === "development",
    })
    module.exports = withPWA({
    reactStrictMode: false,
    })
    After compleating everything else the Download icon is missing. In my case the cause was an entry in the manifest.json.
    Exchange the following entry
    "start_url": "/"
    with
    "start_url":"/app/"

  • @ronnyjubhari9042
    @ronnyjubhari9042 2 года назад

    Can i use next.js with codeigniter, how to connect it to views folder in codeigniter?
    How to change default page/ home page next.js to codeigniter php file?

  • @piyushjaiswal6238
    @piyushjaiswal6238 Год назад

    hey! I am using next-pwa 5.5.0 .Doing everything right and tried evrything but service-worker.js is not generating on npm run build. please help someone

  • @krtirtho
    @krtirtho 3 года назад +1

    Hw you're getting VIM like autocomplete in VSCode terminal?🤔

    • @JamesQQuick
      @JamesQQuick  3 года назад +1

      It’s an app called fig :)

    • @krtirtho
      @krtirtho 3 года назад

      @@JamesQQuick Thanks for letting me know

  • @aggbits
    @aggbits 3 года назад

    Ty for your great videos!
    Is the first request served via SSR or the app is not rendered on the server side at all?

  • @sonwander1
    @sonwander1 2 года назад

    Hello! Thanks for the video! What if i have a wordpress installation as backend using GraphQL? Is the process similar to this?

  • @iknowishare-9705
    @iknowishare-9705 Месяц назад

    Amazing tips.
    Thank you so much 🥰

  • @PaulBilton
    @PaulBilton 3 года назад +3

    Great video - thank you! ...I'd like to learn and understand when to use ReactJS Native or PWA for a mobile web application - benefits and shortfalls - please. Thanks

  • @LarsRyeJeppesen
    @LarsRyeJeppesen 2 года назад +1

    Build fails, missing error pages

    • @angel-pu7su
      @angel-pu7su 2 года назад

      Replace the code in your 'next.config.js' with the below:
      /** @type {import('next').NextConfig} */
      const withPWA = require("next-pwa");
      module.exports = withPWA({
      reactStrictMode: true,
      pwa: {
      dest: "public",
      register: true,
      skipWaiting: true,
      disable: process.env.NODE_ENV === "development",
      },
      });
      Copy and paste exactly is.

  • @alvidervishaj231
    @alvidervishaj231 3 года назад +1

    How do you get auto complete in terminal ?

    • @chaseharrison7002
      @chaseharrison7002 3 года назад

      as you type press tab.. so in the terminal, let's say you want to cd into Documents:
      cd Docu (now press tab!)
      ...you will see:
      cd Documents

    • @JamesQQuick
      @JamesQQuick  3 года назад +1

      That and I’m using an app called fig which provides intellisense before pressing tab

  • @tushar.musique
    @tushar.musique 3 года назад +1

    Very helpful. Learned a new thing today.

  • @webpapi
    @webpapi 3 года назад +1

    Tested this and works fine on localhost:3000 (dev mode) but fails to deploy to Prod. Hosting on Vercel as well. 'Unable to fetch manifest' on chrome latest version.

  • @cbc911
    @cbc911 3 года назад +1

    What icon pack are you using?

  • @jeanchrinot
    @jeanchrinot 9 месяцев назад

    I implemented this. It is amazing.

  • @aayamshrestha5982
    @aayamshrestha5982 3 года назад +2

    Love these videos. Can you please make playlist about google app scripts

  • @semiloreidowu4601
    @semiloreidowu4601 3 года назад +1

    This is very cool, definitely trying it out immediately

  • @DelightBessie
    @DelightBessie 3 месяца назад

    Can you please update the tutorial for next.js 14

  • @andressalomon6703
    @andressalomon6703 3 года назад +1

    Great video!! Thank you very much James!

  • @TheFilmAnonymous
    @TheFilmAnonymous 2 года назад

    so @whattheyknew & we dnot know was PWA can be build with anything, not necessarily with just one thing - just learn javascript and there are a plenty isn't it ? or ?

  • @linchen5913
    @linchen5913 3 года назад +2

    Hi, all!
    I've heard of PWA for a while and I've create a few myself. However, it seems nobody's using PWA in the real world? To my experience, people are still using native application rather than PWA. What's your opinion on this?

    • @nikoreva2078
      @nikoreva2078 3 года назад +2

      You need to tell people to install your app and give them instructions how to do that. But I agree, this feature - while cool and useful - is still not "mainstream".

    • @LarsRyeJeppesen
      @LarsRyeJeppesen 2 года назад

      You must be new lol

    • @linchen5913
      @linchen5913 2 года назад +1

      @@LarsRyeJeppesen Indeed! After some discussion with people other than my country, I found that only people in my country don't use PWA!!!

    • @santiagoparadelo1843
      @santiagoparadelo1843 2 года назад +1

      ​@@linchen5913 Here in Argentina, people dont use PWA either. But I agreed with Niko Reva, if u add some instructions maybe people will use it !

    • @linchen5913
      @linchen5913 2 года назад +2

      @@santiagoparadelo1843 Isn't it enough for the user if the browser ask you to add the app to your desktop?

  • @icanamer7113
    @icanamer7113 Год назад

    Hi
    this actually was a great video,
    but I also have a question:
    is there a way to not use the manifest.json and just making the setup directly from the _document file itself?

  • @jopercito
    @jopercito Год назад

    no working in next js 13 ?

  • @palina-live
    @palina-live Год назад +1

    Thank you so much for the clear explanation! 😀

  • @SharmaTushar1-yt
    @SharmaTushar1-yt Год назад

    Make sure to use a png file for manifest.json. I was using an svg.

  • @tapasadhikary
    @tapasadhikary 3 года назад +1

    This is cool. Thanks for sharing.

  • @joematkin3540
    @joematkin3540 2 года назад +1

    ANYONE HAVING ISSUES: install old version of next-pwa the new version not working with nextjs new update yet:
    npm install next-pwa@5.5.4
    Just echoing what someone else said.

  •  3 года назад

    Hi @James . Great video as usual. I was wondering why you don't change the theme color or the url of the apple-touch-icon ?

    • @JamesQQuick
      @JamesQQuick  3 года назад +1

      Hey hey! I'm not sure what that specific setting is? lol

  • @xHeroinBoBx
    @xHeroinBoBx 3 года назад

    What extension are you using for the bundle size or import size inline? When you imported next-pwa it said calculating... thanks :-)

    • @sarcasticdna
      @sarcasticdna 3 года назад

      Extension name is import-cost I guess

  • @denniszenanywhere
    @denniszenanywhere 3 года назад +2

    Next is? I thought you switched to svelte all the way? 😃 it’s ok. Can you do a next js vs svelte project? Do both and show us differences? Thanks

  • @geekySRM
    @geekySRM 3 года назад +1

    This is awesome!

  • @mhayk
    @mhayk 3 года назад +1

    Very helpful. Thank you !

  • @mdkutubail8848
    @mdkutubail8848 Год назад

    thanks broo it was very helpful for me

  • @ihechikaraav
    @ihechikaraav 3 года назад +1

    Thanks for the video.
    Anyway to get in touch with you privately?

    • @JamesQQuick
      @JamesQQuick  3 года назад

      Sure email me at james.q.quick@gmail.com

  • @gordgood6506
    @gordgood6506 3 года назад

    You saved my arse man. Love you.

  • @shoebilyas9664
    @shoebilyas9664 2 года назад

    A very well explanation. Thanks a lot :).

  • @mohamedboularas6480
    @mohamedboularas6480 2 года назад

    Hello greate tuto, please create same video for pwa for mobile

  • @SandraWantsCoke
    @SandraWantsCoke Год назад

    There's no zip generated, only some .html file

    • @mythm2063
      @mythm2063 Год назад

      me too, did you resolve it ?

    • @SandraWantsCoke
      @SandraWantsCoke Год назад

      @@mythm2063 I wrote the manifest file per hand and used some other online manifest icon generator (I really don't remember which, but I guess just pick any one)

    • @mythm2063
      @mythm2063 Год назад

      @@SandraWantsCoke did you get the install button at teh end
      because i did that too but after building i still don't see the install feature.

  • @sinashohrat2353
    @sinashohrat2353 3 года назад +1

    this was helpful ty

  • @vascorebolo
    @vascorebolo 3 года назад

    Really nice video.
    I was trying this myself, I did everything as in the video, even went through Avneesh's article just to make sure, but I can never see the icon to download the PWA in the browser. I'm using Chrome Version 95.0.4638.69, node v16.13.0, yarn 1.22.17, next-pwa 5.4.0. Does anyone had any issue or have a clue on what's going on? Thanks

    • @ramonmorcillo205
      @ramonmorcillo205 2 года назад

      Hi Vasco! I am having the same issue, actually. Did you find a way to solve it? :)

    • @franciscoramos8381
      @franciscoramos8381 2 года назад

      Same here 😢

    • @d8mle
      @d8mle 2 года назад +1

      I have the same problem. Would love to hear if anybody got this to work.
      Edit: Found out that you need to make sure there is no mistakes in your manifest file. Inspect the site in chrome and check you Application tab. It should tell if there is any issues with the manifest. Fix them and everything will work.

  • @us28363hdhd
    @us28363hdhd 2 года назад

    2:48 video starts here

  • @warrior_pk
    @warrior_pk Год назад

    It works on desktop but not on phone

  • @TheIguana3d
    @TheIguana3d 2 года назад

    wow, thank you very much!

  • @dawid_dahl
    @dawid_dahl 2 года назад

    Awesome, thanks!

  • @michaelklit7799
    @michaelklit7799 11 месяцев назад

    Great and informative. But it aint working anymore :). A lot of those folders dont show up when following the video

    • @slavenDj
      @slavenDj 10 месяцев назад

      u are probaly using app routes instead of page routes

    • @michaelklit7799
      @michaelklit7799 10 месяцев назад

      no clue I followed it exactly like shown, got a plugin instead since the future of PWA is hanging in a thread and is basically only working properly on Chrome @@slavenDj
      But in my experience. Anything that uses NPM is bound to break at any given time.

  • @VKD007
    @VKD007 3 года назад +1

    Class component 😂💯

  • @johnyepthomi892
    @johnyepthomi892 3 года назад

    Good content. I hope you’re getting enough rest. Don’t overwork yourself.

    • @JamesQQuick
      @JamesQQuick  3 года назад

      I'm not. I just always have bags. I sleep lots :)

  • @mateuspamaral00
    @mateuspamaral00 Год назад

    Really cool thanks

  • @Perrynatufe9105
    @Perrynatufe9105 11 месяцев назад

    Thanks

  • @loveboat
    @loveboat Год назад

    Nextjs 13 blew this approach into smithereens.

  • @unpluggedaman
    @unpluggedaman 3 года назад

    Thanks a lot

  • @mdbillalyasir
    @mdbillalyasir 2 года назад

    on your mac screen, there is a video called beakfast, please correct this spelling.🙃

  • @shinjansaha240
    @shinjansaha240 6 месяцев назад

    If anyone wants it for NextJS 14
    import withPWA from 'next-pwa';
    const nextConfig = {
    reactStrictMode: true,

    };
    export default withPWA({
    dest: 'public',
    // disable: process.env.NODE_ENV === 'development',
    })(nextConfig);

  • @TorgeirFredriksen
    @TorgeirFredriksen 3 года назад

    Now imagine if you could use this on iOS devices...

    • @JamesQQuick
      @JamesQQuick  3 года назад

      Why can't you? You can use PWAs on iOS devices :)

  • @yashchauhan5710
    @yashchauhan5710 3 года назад +1

    opppppppp ty spp good

  • @apriliandi__
    @apriliandi__ 3 года назад +3

    Next : PWA with Sveltekit....

  • @familyiseverything1617
    @familyiseverything1617 3 года назад

    Wow

  • @hasindusithmin1074
    @hasindusithmin1074 3 года назад

    👍

  • @StijnHommes
    @StijnHommes 3 года назад +1

    2:35 And that is a great example of PWAs are misleading. Why would you run Twitter outside your browser? There is literally no benefit whatsoever.

    • @JamesQQuick
      @JamesQQuick  3 года назад +2

      There is actually. I can toggle to it as a separate app instead of switching through 10 tabs to find it. And that’s on desktop. It’s even more beneficial on mobile devices

    • @breezystormatic827
      @breezystormatic827 3 года назад

      @@JamesQQuick plus there is the notifications part. idk if it's widely supported yet.

    • @StijnHommes
      @StijnHommes 3 года назад

      @@JamesQQuick You can do the same by opening this in a separate browser window instead of a tab or by making an actual app. No reason to introduce malware to do something you can already do.

    • @StijnHommes
      @StijnHommes 3 года назад +1

      @@breezystormatic827 websites can also send notifications. Most people choose to turn those off anyway, so that isn't a benefit either.

    • @StijnHommes
      @StijnHommes 3 года назад

      2:10 Twitter isn't just a progressive web app. It allows you to get misled and install a fake app (Twitter Lite), but they actually still offer the real native application.

  • @ZXZXZXZvvvZXZXZXZ
    @ZXZXZXZvvvZXZXZXZ 2 года назад

    Тут меньше воды и понятнее:
    ruclips.net/video/ESiMRPOlLxU/видео.html

  • @seesmof
    @seesmof 7 месяцев назад

    GOD bless, get saved from hell: repent of your sins and put your faith in the Lord Jesus Christ ✝💓

  • @LarsRyeJeppesen
    @LarsRyeJeppesen 2 года назад

    Mindboggling how clumsy and complex this is compared to angular, svelte, vue. React is really horrible

    • @blazi_0
      @blazi_0 2 года назад

      wired it looks very clean and not complex at all to me. its about how much exp. you have with react apps. im begginer in nextjs but i understand it perfectly

  • @StijnHommes
    @StijnHommes 3 года назад +1

    1:05 A a PWA is actually seriously misnamed. It's not an app. Just a fancy website built using malware "technology" by "developers" who can't be bothered to code a real native app. Stop taking the easy way out and build the app users deserve.

  • @StijnHommes
    @StijnHommes 3 года назад +1

    Why not build real native apps? Don't you want your users to get the best possible app instead of a fancy website?

    • @JamesQQuick
      @JamesQQuick  3 года назад

      Great question. The speed to development is worth considering especially if you have a team full of react developers. This enables to you to leverage the same skill set to hit multiple platforms. If you have specific needs and need to specifically go native that’s understandable. However you can get a lot of that with a pwa

    • @StijnHommes
      @StijnHommes 3 года назад

      @@JamesQQuick Let me rephrase: why should I (as a user) care about how easy it is for a developer to use?
      I've already seen way too many PWA's that fail at being responsive and interactive when that is supposedly their main strength.

    • @LarsRyeJeppesen
      @LarsRyeJeppesen 2 года назад

      Lol

  • @WanderingBall
    @WanderingBall Год назад

    err : ./node_modules/@nodelib/fs.scandir/out/adapters/fs.js:4:0
    Module not found: Can't resolve 'fs'

  • @utkarshsrivastav3039
    @utkarshsrivastav3039 Год назад

    after running the build command i am not getting sw.js in public folder why??

  • @FGA-47
    @FGA-47 7 месяцев назад

    Thanks