Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
use old urls for svelte <= 3.4.4 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Jun 3, 2019
1 parent 2df9603 commit 2c16280
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/workers/bundler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ async function get_bundle(uid, mode, cache, lookup) {

// importing from Svelte
if (importee === `svelte`) return `${svelteUrl}/index.mjs`;
if (importee.startsWith(`svelte/`)) return `${svelteUrl}/${importee.slice(7)}.mjs`;
if (importee.startsWith(`svelte/`)) {
const m = svelteUrl.match(/@3\.(\d+)\.(\d+)$/);
if (m) {
if (+m[1] < 4 || +m[1] === 4 && +m[2] < 4) {
return `${svelteUrl}/${importee.slice(7)}.mjs`;
}
}
return `${svelteUrl}/${importee.slice(7)}/index.mjs`;
}

// temporary workaround for lack of package.json files in sub-packages
// https://github.com/sveltejs/svelte/pull/2887
Expand Down Expand Up @@ -285,4 +293,4 @@ async function bundle({ uid, components }) {
})
};
}
}
}

0 comments on commit 2c16280

Please sign in to comment.