Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sites/svelte-5-preview/src/lib/workers/bundler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ async function get_bundle(uid, mode, cache, local_files_lookup) {
name: 'svelte-repl',
async resolveId(importee, importer) {
if (uid !== current_id) throw ABORT;

if (importee === 'esm-env') return importee;

const v5 = is_v5();
const v4 = !v5 && is_v4();

Expand Down Expand Up @@ -358,6 +361,10 @@ async function get_bundle(uid, mode, cache, local_files_lookup) {
async load(resolved) {
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);
if (cached_file) return cached_file.source;

Expand Down
Loading