Skip to content

Commit

Permalink
fix: css inject during SSR dev, replace @vueuse/head with @unhead/vue…
Browse files Browse the repository at this point in the history
…, use unbuild instead of rollup (#2)
  • Loading branch information
yooouuri authored Dec 20, 2023
1 parent 41708ee commit cdd25b7
Show file tree
Hide file tree
Showing 15 changed files with 1,556 additions and 345 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules
pnpm-debug.log*
dist
.idea
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Vite plugin to develop Vue SSR apps
* Vue Router
* State management
* Teleports
* Document head management (powered by [@vueuse/head](https://github.com/vueuse/head))
* [Unhead](https://unhead.unjs.io) support

## Quick Setup

Expand Down
22 changes: 22 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
{
input: './src/index.ts',
outDir: './dist',
},
{
input: 'src/plugin/index.ts',
outDir: 'dist/plugin',
}
],
externals: ['express', /@unhead/],
clean: true,
declaration: true,
rollup: {
esbuild: {
minify: true,
},
},
})
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build:server": "vite build --ssr src/main.ts --outDir dist/server"
},
"dependencies": {
"@vueuse/head": "^1.3.1",
"@unhead/vue": "^1.8.9",
"cookie-parser": "^1.4.6",
"express": "^4.18.2",
"pinia": "^2.1.7",
Expand Down
16 changes: 15 additions & 1 deletion example/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<script setup lang="ts">
import { useHead } from '@unhead/vue'
useHead({
title: 'Example app, using vite-plugin-vue-ssr'
})
</script>

<template>
<router-view></router-view>
<RouterView />
</template>

<style>
body {
background: yellow;
}
</style>
1 change: 0 additions & 1 deletion example/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { vueSSR } from 'vite-plugin-vue-ssr'
import { createPinia } from 'pinia'

import App from '@/App.vue'

const Counter = () => import('@/Counter.vue')
Expand Down
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
},
"exports": {
".": {
"import": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./plugin": {
"import": "./dist/plugin/index.js",
"import": "./dist/plugin/index.mjs",
"types": "./dist/plugin/index.d.ts"
}
},
"files": [
"dist"
],
"scripts": {
"build": "rollup -c",
"dev": "rollup -w -c",
"dev": "unbuild --stub",
"build": "unbuild",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
Expand All @@ -41,24 +41,20 @@
"@babel/types": "^7.23.3",
"@nuxt/devalue": "^2.0.2",
"@types/express": "^4.17.21",
"@unhead/schema": "^1.8.3",
"cheerio": "1.0.0-rc.12",
"cookie-parser": "^1.4.6"
},
"devDependencies": {
"@types/node": "^18.18.9",
"@vueuse/head": "^1.3.1",
"esbuild": "^0.17.19",
"rollup": "^3.29.4",
"rollup-plugin-dts": "^5.3.1",
"rollup-plugin-esbuild": "^5.0.0",
"@unhead/vue": "^1.8.9",
"typescript": "^5.1.6",
"unbuild": "^2.0.0",
"vite": "^5.0.0",
"vue": "^3.3.8",
"vue-router": "^4.2.5"
},
"peerDependencies": {
"@vueuse/head": "^1.3.1",
"@unhead/vue": "^1.8.9",
"vite": "^5.0.0",
"vue": "^3.3.8",
"vue-router": "^4.2.5"
Expand Down
Loading

0 comments on commit cdd25b7

Please sign in to comment.