File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change
1
+ <script lang="ts" setup>
2
+ definePage ({
3
+ meta: {
4
+ title: ' hello' ,
5
+ },
6
+ })
7
+ </script >
8
+
1
9
<template >
2
10
<main >
3
11
<h1 >Home</h1 >
Original file line number Diff line number Diff line change @@ -31,16 +31,18 @@ export function definePageTransform({
31
31
code : string
32
32
id : string
33
33
} ) : Thenable < TransformResult > {
34
- if ( ! code . includes ( MACRO_DEFINE_PAGE ) ) return
34
+ // are we extracting only the definePage object
35
+ const isExtractingDefinePage = MACRO_DEFINE_PAGE_QUERY . test ( id )
36
+
37
+ if ( ! code . includes ( MACRO_DEFINE_PAGE ) ) {
38
+ return isExtractingDefinePage ? 'export default {}' : undefined
39
+ }
35
40
36
41
// TODO: handle also non SFC
37
42
38
43
const sfc = parseSFC ( code , id )
39
44
if ( ! sfc . scriptSetup ) return
40
45
41
- // are we extracting only the definePage object
42
- const isExtractingDefinePage = MACRO_DEFINE_PAGE_QUERY . test ( id )
43
-
44
46
const { script, scriptSetup, getSetupAst } = sfc
45
47
const setupAst = getSetupAst ( )
46
48
You can’t perform that action at this time.
0 commit comments