Skip to content

Commit

Permalink
fix: should not overwrite render when no <template> is present
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Feb 4, 2020
1 parent 346b9df commit 04903b6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const loader: webpack.loader.Loader = function(source: string) {
options.hotReload !== false

// template
let templateImport = `const render = () => {}`
let templateImport = ``
let templateRequest
if (descriptor.template) {
const src = descriptor.template.src || resourcePath
Expand Down Expand Up @@ -175,8 +175,10 @@ const loader: webpack.loader.Loader = function(source: string) {
templateImport,
scriptImport,
stylesCode,
`script.render = render`
].join('\n')
templateImport ? `script.render = render` : ``
]
.filter(Boolean)
.join('\n')

// attach scope Id for runtime use
if (hasScoped) {
Expand Down

0 comments on commit 04903b6

Please sign in to comment.