I have so far a very basic integration of Prismic with a website, without any styles, just callbacks from an About page. I am programming this based on the Awwwards course by Luis Bizarro. I am using Webpack and Express.js and for that I've opted to use cross-fetch instead of node-fetch.
The problem is: everytime I refresh the About page, I get a wait times of around 700ms to sometimes around 1600ms as shown in the images below.
What is going on with this?
Here you have the code I use to integrate things, for you guys to shine a light on what's going on here.
Hi. No problem. I could but I don't know how to use node fetch with require instead of import. This is important because I am using Webpack + Express.js and am unable to do somethings if I don't use requires because my knowledge is kind of limited.
Ok, so I tried these (even with the version 1.7.3 as well) and the results are the same - somewhere around 700ms and 1200ms for the most part and sometimes it goes even to 2500ms in rare cases. So I think we can rule out the cross-fetch option.
No sir @Fares I didn't try that. But I tried right now using an older version using Prismic.DOM which I developed somewhere around December 2021. It was another iteration of the project, which then I redesigned and restarted from zero last week.
I went back and used the implementation I had with the new fields I have in Prismic and even though the response times are slow (they fluctuate between 500 and 600ms. Only once so far in the order of the 900ms, but always below 1000ms.), they are much much better.
But of course that can't be a solution, using an older version of the API. And also, I really like the way things are in the present with the Prismic API.
Unfortunately that's not the problem. I tried that already and it's the same thing. Actually, what cross-fetch does is it goes and gets node-fetch and that's the version it's getting in this case, so it's not the problem. Even though it isn't the problem, I am now using node-fetch@2.6.7 because it's one less step.
I don't. I never used slices, but you can look throughout the documentation. Sometimes it's a bit confusing but if you look long enough you'll manage to answer your questions.
I ended up trying Contentful last night and the response times, even though they seem to me a bit high still (in the order of the 300ms), they never go as big as the Prismic ones do, so I'm really tempted to use their option, even though I like much more using Prismic, especially because of the ease of use and it feels like it's better for bigger websites.
I will reach out to our dev team to check this issue; the response time you get is not normal and might be related to some wrong implementation from your side.
A related note that I would like to mention is that have you thought of using a static website builder framework such as Next.js, Nuxt.js, or Gatsby with Prismic?
A statically built website runs way faster than a simple Node.js one
I didn't, no. Especially because in my daily life I use mostly Wordpress and also I feel like this way I get my projects cleaner and it's something less to learn. Also more future proof using basic Javascript.