npm i -D vite-ssgvue-router @unhead/vue // package.json { "scripts": { "dev": "vite",-"build": "vite build"+"build": "vite-ssg build"// OR if you want to use another vite config file+"build": "vite-ssg build -c another-vite.config.ts"} ...
Vite-SSG(Vite Static Site Generator) 是一个基于 Vite 的静态网站生成器插件。它允许开发者在构建时生成静态 HTML 文件,从而优化页面加载速度和搜索引擎优化(SEO)。Vite-SSG 特别适用于那些需要快速部署且对 SEO 有高要求的 Vue.js 项目。 2. 如何在Vue3项目中集成vite-ssg 要在Vue3 项目中集成 vite-ssg,...
如果你正在使用vite-sse或者vite-ssg,通过下面的步骤设定naive-ui。 1. 安装naive-ui、@css-render/vue3-ssr # pnpmpnpm i naive-ui @css-render/vue3-ssr# npmnpm i naive-ui @css-render/vue3-ssr 2. 修改vite.config.ts import{ setup }from'@css-render/vue3-ssr'defineConfig({ssr: {noExterna...
vite-ssg用法 vite-ssg(静态生成)是一种使用 Vite 构建静态网站的方法。通过使用 Vite SSG,你可以将你的 Vue.js 应用构建为静态网站,以便在服务器上托管和部署。©2022 Baidu |由 百度智能云 提供计算服务 | 使用百度前必读 | 文库协议 | 网站地图 | 百度营销 ...
"dev": "vite",- "build": "vite build"+ "build": "vite-ssg build"// 想使用另外的vite配置文件,不使用原本的vite.config.ts,把build的命令改成下面这样+ "build": "vite-ssg build -c another-vite.config.ts"} } src/router/index.ts(vue-router) ...
技术栈是Vite+Vue3+TS+Pinia,使用vite-ssg打包时客户端已经打包了,SSR渲染时报错Error: [vite-ssg] Error on page: / ReferenceError: document is not definedgithub上找到了类似的issues,https://github.com/antfu-collective/vite-ssg/issues/417及https://github.com/antfu-collective/vite-ssg/issues/406,似...
所以Vite-SSG 项目的main.js一般长这个样子: importAppfrom'./App.vue'import{ViteSSG}from'vite-ssg'importroutesfrom'~pages';importvuetifyfrom'./plugins/vuetify';exportconstcreateApp=ViteSSG(App,// vue-router options{routes,scrollBehavior:()=>({top:0})},// function to have custom setups({app...
所以Vite-SSG 项目的main.js一般长这个样子: import App from './App.vue' import { ViteSSG } from 'vite-ssg' import routes from '~pages'; import vuetify from './plugins/vuetify'; export const createApp = ViteSSG( App, // vue-router options {routes, scrollBehavior: () => ({ top: 0...
所以Vite-SSG 项目的main.js一般长这个样子: importAppfrom'./App.vue'import{ViteSSG}from'vite-ssg'importroutesfrom'~pages';importvuetifyfrom'./plugins/vuetify';exportconstcreateApp =ViteSSG(App,// vue-router options{routes,scrollBehavior:() =>({top:0}) },// function to have custom setups(...
This is the case when using tools like vite-ssg.import { defineConfig } from 'vite' import SSGUtils from 'vite-plugin-ssg-utils' export default defineConfig({ plugins: [ // The options are not required. // Default values are used in the following example. SSGUtils({ resizeObserver: ...