Skip to content

Commit 04903b6

Browse files
committed
fix: should not overwrite render when no <template> is present
1 parent 346b9df commit 04903b6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/index.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const loader: webpack.loader.Loader = function(source: string) {
117117
options.hotReload !== false
118118

119119
// template
120-
let templateImport = `const render = () => {}`
120+
let templateImport = ``
121121
let templateRequest
122122
if (descriptor.template) {
123123
const src = descriptor.template.src || resourcePath
@@ -175,8 +175,10 @@ const loader: webpack.loader.Loader = function(source: string) {
175175
templateImport,
176176
scriptImport,
177177
stylesCode,
178-
`script.render = render`
179-
].join('\n')
178+
templateImport ? `script.render = render` : ``
179+
]
180+
.filter(Boolean)
181+
.join('\n')
180182

181183
// attach scope Id for runtime use
182184
if (hasScoped) {

0 commit comments

Comments
 (0)