Skip to content

Commit

Permalink
fix: handle null init in page meta plugin (#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
wattanx authored Nov 13, 2023
1 parent 7f1bf0a commit 9190c99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/bridge/src/page-meta/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ export const PageMetaPlugin = createUnplugin(

const declaration = getDeclaration(exportDeclaration)

if (!declaration) {
return
}

const objectExpression = getObjectExpression(declaration)

if (!objectExpression) {
Expand Down
9 changes: 9 additions & 0 deletions playground/pages/with-layout.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<script setup>
let message
if (process.client) {
message = 'Client'
} else if (process.server) {
message = 'Server'
}
console.log(message)
definePageMeta({
layout: 'custom'
})
Expand Down

0 comments on commit 9190c99

Please sign in to comment.