Skip to content

Commit 4820259

Browse files
authored
chore: allow preview site to work offline in local dev (#11091)
1 parent ce348f0 commit 4820259

File tree

1 file changed

+7
-0
lines changed
  • sites/svelte-5-preview/src/lib/workers/bundler

1 file changed

+7
-0
lines changed

sites/svelte-5-preview/src/lib/workers/bundler/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ async function get_bundle(uid, mode, cache, local_files_lookup) {
260260
name: 'svelte-repl',
261261
async resolveId(importee, importer) {
262262
if (uid !== current_id) throw ABORT;
263+
264+
if (importee === 'esm-env') return importee;
265+
263266
const v5 = is_v5();
264267
const v4 = !v5 && is_v4();
265268

@@ -358,6 +361,10 @@ async function get_bundle(uid, mode, cache, local_files_lookup) {
358361
async load(resolved) {
359362
if (uid !== current_id) throw ABORT;
360363

364+
if (resolved === 'esm-env') {
365+
return `export const BROWSER = true; export const DEV = true`;
366+
}
367+
361368
const cached_file = local_files_lookup.get(resolved);
362369
if (cached_file) return cached_file.source;
363370

0 commit comments

Comments
 (0)