nuxt generate
is not creating pre-rendered html pages when target is static.
#8218
Replies: 4 comments 6 replies
-
У меня была такая же проблема. Попробуйте убрать строку I had the same problem. Try removing the string |
Beta Was this translation helpful? Give feedback.
-
You need to set If you don't want full static mode, with fetch run at generate time and payloads generated then, you can set |
Beta Was this translation helpful? Give feedback.
-
Thanks guys... 65 days and then two answer in the space of minutes :) @inmake, thanks for the example I'll check it out! @danielroe, I do want fetch run at generate time and payloads generated then (so that I can serve fully pre-rendered html pages), but I also want fetch to be called at run time. "When I switch ssr to true then I get the full static mode mentioned here, but this means that the fetch method is not called on route change." Do I need to call fetch from mounted or created for this to work as I'd like? |
Beta Was this translation helpful? Give feedback.
-
I have exactly the same problem. When I run
|
Beta Was this translation helpful? Give feedback.
-
Is this expected? For a sample html page generated in the
/dist
folder, I get the following body (the head has all the metadata and pre-fetch information):I have
ssr: false
. From reading around it's suggested thatnuxt generate
is supposed to pre-render the pages but besides the head information, they only have the .js files to load like a regular SPA page with no pre-rendering. When I disable javascript in the browser, I get a large white spinner (chrome) when accessing the/dist
folder served throughnuxt start
.When I switch
ssr
totrue
then I get the full static mode mentioned here, but this means that the fetch method is not called on route change.Adding the following plugin to run on the client only:
and
{ src: '~/plugins/preview-mode', ssr: false },
...works, but it feels like a hack and probably not what I should be doing.
Is there any way to get
nuxt generate
to generate the html pages that I'm seeing it generate whenssr
istrue
?Beta Was this translation helpful? Give feedback.
All reactions