Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed May 16, 2024
1 parent cf05860 commit 77e43d3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { Miniflare } from "miniflare";

const modules = {
"/hello.js": {
esModule: 'export const hello = "Hello";',
"/foo/hello.js": {
esModule: `
import {foo} from "./foo.js";
export const hello = "Hello" + foo;`,
},
"/foo/foo.js": {
esModule: `
export const foo = " bar"`,
},
};

Expand All @@ -14,6 +21,7 @@ const mf = new Miniflare({
}

const url = new URL(request.url);
console.log(`--- Fallback service debug info ---\nresolve method: ${resolveMethod}\nurl: ${url}\nspecifier: ${url.searchParams.get("specifier")}\nreferrer: ${url.searchParams.get("referrer")}\nraw: ${url.searchParams.get("raw")}`);
const specifier = url.searchParams.get("specifier");
if (!specifier) {
throw new Error("no specifier provided");
Expand Down Expand Up @@ -41,7 +49,7 @@ const mf = new Miniflare({
contents: `
export default {
async fetch() {
const { hello } = await import("./hello.js");
const { hello } = await import("./foo/hello.js");
return new Response(hello + " World");
}
}
Expand Down

0 comments on commit 77e43d3

Please sign in to comment.