Skip to content

Commit befc0a4

Browse files
committed
fix: better "bundling aborted" check
error object might be augmented, see https://github.com/rollup/rollup/blob/76a3b8ede4729a71eb522fc29f7d550a4358827b/docs/plugin-development/index.md#thiserror, hence only check that the specific abort property we set is there
1 parent 65c0da5 commit befc0a4

File tree

1 file changed

+6
-2
lines changed
  • packages/repl/src/lib/workers/bundler

1 file changed

+6
-2
lines changed

packages/repl/src/lib/workers/bundler/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ self.addEventListener('message', async (event: MessageEvent<BundleMessageData>)
7676

7777
console.log('[bundle worker result]', result);
7878

79-
if (JSON.stringify(result.error) === JSON.stringify(ABORT)) return;
79+
// error object might be augmented, see https://github.com/rollup/rollup/blob/76a3b8ede4729a71eb522fc29f7d550a4358827b/docs/plugin-development/index.md#thiserror,
80+
// hence only check that the specific abort property we set is there
81+
if ((result.error as any)?.svelte_bundler_aborted === ABORT.svelte_bundler_aborted) {
82+
return;
83+
}
8084
if (result && uid === current_id) postMessage(result);
8185
});
8286
} catch (e) {
@@ -111,7 +115,7 @@ function get_svelte(svelte_version: string) {
111115
return ready;
112116
}
113117

114-
const ABORT = { aborted: true };
118+
const ABORT = { svelte_bundler_aborted: true };
115119

116120
let previous: {
117121
key: string;

0 commit comments

Comments
 (0)