Skip to content

Commit 5b9f389

Browse files
authored
Use optional chaining to catch null error codes in error.js
Starting a new vite project and selecting svelte-ts template results in an error, because `code` var in error.js is null. Optional chaining resolves this issue.
1 parent d215c88 commit 5b9f389

File tree

1 file changed

+1
-1
lines changed
  • packages/vite-plugin-svelte/src/utils

1 file changed

+1
-1
lines changed

packages/vite-plugin-svelte/src/utils/error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function formatFrameForVite(frame) {
108108
* @returns {boolean}
109109
*/
110110
function couldBeFixedByCssPreprocessor(code) {
111-
return code === 'expected_token' || code === 'unexpected_eof' || code.startsWith('css_');
111+
return code === 'expected_token' || code === 'unexpected_eof' || code?.startsWith('css_');
112112
}
113113

114114
/**

0 commit comments

Comments
 (0)