serveStatic not working (ReferenceError: __STATIC_CONTENT_MANIFEST is not defined)
See original GitHub issueInfo
- hono : 1.3.3
- wrangler : v2
Wrangler configuration -
name = "test"
main = "src/index.ts"
compatibility_date = "2022-05-13"
kv_namespaces = [
{ binding = "ARNAB", preview_id = "", id="" }
]
[site]
bucket = "./public"
Code -
import { Hono } from "hono";
import { serveStatic } from "hono/serve-static";
import { renderSSR } from "nano-jsx";
import Home from "./pages/Home";
const app = new Hono();
app.use("/img/*", serveStatic({ root: "./" }));
app.get("/", async (ctx) => ctx.html(renderSSR(Home)));
export default app;
Assets :
./public
└── img
├── cf.png
Error :
GET /img/cf.png
crashes with an internal server error.
8:46:17 AM GET /img/cf.png 500
ReferenceError: __STATIC_CONTENT_MANIFEST is not defined
[1] at getContentFromKVAsset (index.js:718:9)
[1] at index.js:869:70
[1] at dispatch (index.js:301:34)
[1] at index.js:286:16
[1] at Hono2.dispatch (index.js:660:27)
Issue Analytics
- State:
- Created a year ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
ServeStatic not defined - pure node.js - Stack Overflow
This is the code I can't get to work. My error when trying to run: ReferenceError: serveStatic is not defined ...
Read more >expressjs/serve-static: Serve static files - GitHub
Create a new middleware function to serve files from within a given root directory. The file to serve will be determined by combining...
Read more >Serving static files in Express
To serve static files such as images, CSS files, and JavaScript files, use the express.static built-in middleware function in Express.
Read more >How To Serve Static Files in Express - DigitalOcean
In this article, you will learn how to serve static files in Express. ... An understanding of Node.js is suggested but not required....
Read more >How to Serve Static Files using Express: A Step-by-step Guide
To be able to serve static files with defined routes, we can specify paths in our Express application. ... As you can notice,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @ArnabXD
I’ve released v1.3.4. The
server-static
middleware is now supporting Module Worker. You can write like this:Hi @ArnabXD !
This error occurs only in ES Modules mode.
I’m investigating how to fix it. If you want to use
serveStatic
right now, use Service Worker mode instead.