diff --git a/.changeset/giant-plants-learn.md b/.changeset/giant-plants-learn.md new file mode 100644 index 000000000..5142ca7c4 --- /dev/null +++ b/.changeset/giant-plants-learn.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/vite-plugin-svelte': patch +--- + +fix errorhandling to work with errors that don't have a code property diff --git a/packages/vite-plugin-svelte/src/utils/error.js b/packages/vite-plugin-svelte/src/utils/error.js index cbc375b2d..31e3c5af3 100644 --- a/packages/vite-plugin-svelte/src/utils/error.js +++ b/packages/vite-plugin-svelte/src/utils/error.js @@ -108,7 +108,7 @@ function formatFrameForVite(frame) { * @returns {boolean} */ function couldBeFixedByCssPreprocessor(code) { - return code === 'expected_token' || code === 'unexpected_eof' || code.startsWith('css_'); + return code === 'expected_token' || code === 'unexpected_eof' || code?.startsWith('css_'); } /**