Skip to content

Commit 42b0851

Browse files
fix: handle no template code in .vue file (#11)
close #15
1 parent 5604341 commit 42b0851

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ async function genTemplateCode(
173173
pluginContext: PluginContext,
174174
ssr: boolean
175175
) {
176-
const template = descriptor.template!
176+
const template = descriptor.template
177+
178+
if (!template) {
179+
return 'const _sfc_render = null; const _sfc_staticRenderFns = null'
180+
}
181+
177182
const hasScoped = descriptor.styles.some((style) => style.scoped)
178183

179184
// If the template is not using pre-processor AND is not using external src,

0 commit comments

Comments
 (0)