From 874945afd8d8309aa1a7f811523561ed664fe223 Mon Sep 17 00:00:00 2001 From: Nik Date: Wed, 21 Sep 2022 16:05:15 +1000 Subject: [PATCH 1/2] Quick check for undefined s4 --- packages/package/src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/package/src/utils.js b/packages/package/src/utils.js index 0b263857b54c..0019706103a7 100644 --- a/packages/package/src/utils.js +++ b/packages/package/src/utils.js @@ -52,7 +52,7 @@ export function strip_lang_tags(content) { .replace( /()|(]*?)\s(?:type|lang)=(["'])(.*?)\3/g, // things like application/ld+json should be kept as-is. Preprocessed languages are "ts" etc - (match, s1, s2, _, s4) => (s4.startsWith('application/') ? match : (s1 ?? '') + (s2 ?? '')) + (match, s1, s2, _, s4) => (s4?.startsWith('application/') ? match : (s1 ?? '') + (s2 ?? '')) ) .replace(/()|(]*?)\s(?:type|lang)=(["']).*?\3/g, '$1$2'); } From 9145199246f5b1eb66e0386a985f800c7a88b0af Mon Sep 17 00:00:00 2001 From: Nik Date: Wed, 21 Sep 2022 16:21:22 +1000 Subject: [PATCH 2/2] fix check for undefined on application/ strip --- .changeset/smart-forks-double.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smart-forks-double.md diff --git a/.changeset/smart-forks-double.md b/.changeset/smart-forks-double.md new file mode 100644 index 000000000000..e98f3bbab9e3 --- /dev/null +++ b/.changeset/smart-forks-double.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/package': patch +--- + +fix check for undefined on application/ strip