Skip to content

Commit

Permalink
chore: no ts expression in template syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang authored Oct 18, 2023
1 parent 5847c5d commit 0c1f963
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ module.exports = function (source) {

// script
let scriptImport = `var script = {}`
let isTS = false
// let isTS = false
const { script, scriptSetup } = descriptor
if (script || scriptSetup) {
const lang = script.lang || (scriptSetup && scriptSetup.lang)
isTS = !!(lang && /tsx?/.test(lang))
// isTS = !!(lang && /tsx?/.test(lang))
const externalQuery =
script && !scriptSetup && script.src ? `&external` : ``
const src = (script && !scriptSetup && script.src) || resourcePath
Expand Down Expand Up @@ -151,7 +151,8 @@ module.exports = function (source) {
const query = `?vue&type=template${idQuery}${scopedQuery}${attrsQuery}${resourceQuery}${externalQuery}`
if (enableInlineMatchResource) {
templateRequest = stringifyRequest(
genMatchResource(loaderContext, src, query, isTS ? 'ts' : 'js')
// TypeScript syntax in template expressions is not supported in Vue 2, so the lang is always 'js'
genMatchResource(loaderContext, src, query, 'js')
)
} else {
templateRequest = stringifyRequest(src + query)
Expand Down

0 comments on commit 0c1f963

Please sign in to comment.