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 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'); }