From 3a37b1d5906952360511a7dc41be17f43d3a0381 Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Sun, 29 Sep 2024 14:00:50 +0900 Subject: [PATCH] fix(js): JS doesn't export globally with module import It needs to be re-exported in the caller script. --- README.md | 6 ++++-- src/server.test.ts | 2 +- src/server.ts | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e5494bf..b815e05 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ To do this, simply add the ref name to the sub-directory. 1. Add this code to the `index.ts` ```ts - import "@5ouma/reproxy"; + import { app } from "@5ouma/reproxy"; + export default app; ``` 2. Run these commands @@ -97,7 +98,8 @@ To do this, simply add the ref name to the sub-directory. 2. Add this code to the `index.ts` ```ts - import "@5ouma/reproxy"; + import { app } from "@5ouma/reproxy"; + export default app; ``` 3. Deploy with these commands diff --git a/src/server.test.ts b/src/server.test.ts index 636f618..9340a1e 100644 --- a/src/server.test.ts +++ b/src/server.test.ts @@ -1,7 +1,7 @@ import { assertEquals } from "@std/assert"; import { STATUS_CODE } from "@std/http/status"; -import app from "./server.ts"; +import { app } from "./server.ts"; import { exportRepo, testRef, diff --git a/src/server.ts b/src/server.ts index ae79aa1..84b4eb6 100644 --- a/src/server.ts +++ b/src/server.ts @@ -21,8 +21,7 @@ import { checkRedirect, getContent, type Repository } from "./libs/mod.ts"; * }); * ``` */ -const app: Hono = new Hono(); -export default app; +export const app: Hono = new Hono(); app.use(logger()); app .get("/:ref?", async (ctx: Context) => {