From 2a5c9aa3be4b226ef837d1e1afddb78ac3d8fdfe Mon Sep 17 00:00:00 2001 From: blackie Date: Wed, 18 Oct 2023 18:44:16 +0800 Subject: [PATCH] fix: fix read property error for accessing lang of script (#2060) Co-authored-by: Haoqun Jiang --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index ea1f0177..a65a73ab 100644 --- a/lib/index.js +++ b/lib/index.js @@ -117,7 +117,7 @@ module.exports = function (source) { // let isTS = false const { script, scriptSetup } = descriptor if (script || scriptSetup) { - const lang = script.lang || (scriptSetup && scriptSetup.lang) + const lang = (script && script.lang) || (scriptSetup && scriptSetup.lang) // isTS = !!(lang && /tsx?/.test(lang)) const externalQuery = script && !scriptSetup && script.src ? `&external` : ``