Skip to content

Commit 587592c

Browse files
committed
fix
1 parent 7331110 commit 587592c

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/svelte/src/compiler/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function compileModule(source, options) {
106106
*/
107107
export function parse(source, { filename, rootDir, modern } = {}) {
108108
state.reset_warning_filter(() => false);
109-
state.reset(source, { filename, rootDir }); // TODO it's weird to require filename/rootDir here. reconsider the API
109+
state.reset(source, { filename: filename ?? '(unknown)', rootDir });
110110

111111
const ast = _parse(source);
112112
return to_public_ast(source, ast, modern);

packages/svelte/src/internal/client/runtime.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,15 @@ function handle_error(error, effect, component_context) {
230230
let current_context = component_context;
231231

232232
while (current_context !== null) {
233-
/** @type {string} */
234-
var filename = current_context.function?.[FILENAME];
233+
if (DEV) {
234+
/** @type {string} */
235+
var filename = current_context.function?.[FILENAME];
235236

236-
const file = filename.split('/').pop();
237-
component_stack.push(file);
237+
if (filename) {
238+
const file = filename.split('/').pop();
239+
component_stack.push(file);
240+
}
241+
}
238242

239243
current_context = current_context.p;
240244
}

0 commit comments

Comments
 (0)