Run generate --spa to produce static html files
html files with static pre rendered content for seo, bots, etc...
html files generated only contains the minimal basic of javascript files.
This is a little confusing to me. And it seems that this is not fully documented. I've seen #4036 #2472. But I'm not really sure what to make of this.
Apparently you need the ssr to generate the html files with static pre rendered content?
Static html files with static pre rendered content - that for me was the main pitch using nuxt. But that is barred behind the build mode settings without an explanation. Maybe consider adding an option to generate pre rendered content which can then throw an error if used in conjunction with spa mode.
Please clarify :)
I have the same problem , use mode spa has no static content, it is the same with the content after run build command.
when I use the mode 'univesal', the page of js can not worked
I have resolve this problem ,this is my nuxt.config.js
router: {
mode: 'hash',
base: '/dist/'
},
mode: 'universal',
You probably just want nuxt generate, don't you? 馃
yes, ssr consume more server resource锛孖 want prerender html as a skeleton when build app.
but call api in client not server.
There is a difference between nuxt generate (--universal) and nuxt generate --spa
When you use nuxt generate in universal mode, it'll save a "snapshot" of the server-rendered HTML and save it as file. That means you have the HTML that usually will be provided by the server statically available and the page will still work as an SPA.
With the nuxt generate --spa flag you'd generate a "traditional" SPA without having the prerendered HTML.
right,it works well for me
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
There is a difference between
nuxt generate (--universal)andnuxt generate --spaWhen you use
nuxt generatein universal mode, it'll save a "snapshot" of the server-rendered HTML and save it as file. That means you have the HTML that usually will be provided by the server statically available and the page will still work as an SPA.With the
nuxt generate --spaflag you'd generate a "traditional" SPA without having the prerendered HTML.