diff --git a/index.js b/index.js index 540a155..447b476 100644 --- a/index.js +++ b/index.js @@ -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"`, }, }; @@ -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"); @@ -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"); } }