uimi
v1.0.7
Published
A Server-Side Rendering (SSR) for vue3
Downloads
32
Maintainers
Readme
Introduction
- 💪 Vue 3.0 SSR
- 🔥 Written in TypeScript
Install
pnpm add uimi
理念和初衷
Quick Start
index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>uimi</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./main.ts"></script>
</body>
</html>
main.ts
import { createSSRApp } from 'vue'
import router from './router'
import App from './App.vue'
const app = createSSRApp(App)
app.use(router).mount('#app')
router.ts
import { createRouter, createWebHistory } from 'vue-router'
const routes = {
//some routes
}
export default createRouter({
// only for createWebHistory
history: createWebHistory(),
routes,
})
App.vue
<template>
<div>Hello SSR</div>
<router-view> </router-view>
</template>
vite.config.ts
import { defineConfig } from 'vite'
export default defineConfig({
//this some vite config
build: {
// only set ssr option
ssr: true,
},
})
scripts
{
"name": "test",
"type": "module",
"scripts": {
"dev": "uimi dev",
"build": "uimi build",
"preview": "cd dist && node server.js"
},
"dependencies": {
"uimi": "*"
// other...
}
}
pnpm dev
uimi build
About
- base on vite
License
Copyright (c) 2022-present Yao Yi