chore: allow preview site to work offline in local dev (#11091)

pull/11110/head
Rich Harris 9 months ago committed by GitHub
parent ce348f0d69
commit 48202597de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -260,6 +260,9 @@ async function get_bundle(uid, mode, cache, local_files_lookup) {
name: 'svelte-repl', name: 'svelte-repl',
async resolveId(importee, importer) { async resolveId(importee, importer) {
if (uid !== current_id) throw ABORT; if (uid !== current_id) throw ABORT;
if (importee === 'esm-env') return importee;
const v5 = is_v5(); const v5 = is_v5();
const v4 = !v5 && is_v4(); const v4 = !v5 && is_v4();
@ -358,6 +361,10 @@ async function get_bundle(uid, mode, cache, local_files_lookup) {
async load(resolved) { async load(resolved) {
if (uid !== current_id) throw ABORT; if (uid !== current_id) throw ABORT;
if (resolved === 'esm-env') {
return `export const BROWSER = true; export const DEV = true`;
}
const cached_file = local_files_lookup.get(resolved); const cached_file = local_files_lookup.get(resolved);
if (cached_file) return cached_file.source; if (cached_file) return cached_file.source;

Loading…
Cancel
Save