Skip to content

Commit

Permalink
fix: naive ui编译错误
Browse files Browse the repository at this point in the history
  • Loading branch information
nailiable committed Dec 6, 2024
1 parent ae34cc5 commit bd40004
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
},
"devDependencies": {
"@antfu/eslint-config": "^2.27.3",
"@css-render/vue3-ssr": "^0.15.14",
"@iconify-json/carbon": "^1.2.4",
"@iconify-json/ph": "^1.2.1",
"@intlify/unplugin-vue-i18n": "^4.0.0",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion types/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ declare module 'vue' {
NSpin: typeof import('naive-ui')['NSpin']
NSwitch: typeof import('naive-ui')['NSwitch']
NTooltip: typeof import('naive-ui')['NTooltip']
PCOperationLayer: typeof import('./components/PCOperationLayer.vue')['default']
PlayerBar: typeof import('./../frontend/components/player-bar.vue')['default']
README: typeof import('./../frontend/components/README.md')['default']
RouterLink: typeof import('vue-router')['RouterLink']
Expand Down
13 changes: 13 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,19 @@ export default defineConfig({
await buildServer()
generateSitemap({ outDir: './dist/frontend' })
},
async onBeforePageRender(_, __, appCtx) {
// eslint-disable-next-line ts/ban-ts-comment
// @ts-expect-error
const { collect } = setup(appCtx.app)
;(appCtx as any).__collectStyle = collect
return undefined
},
async onPageRendered(_, renderedHTML, appCtx) {
return renderedHTML.replace(
/<\/head>/,
`${(appCtx as any).__collectStyle()}</head>`,
)
},
},

ssr: {
Expand Down

0 comments on commit bd40004

Please sign in to comment.