Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hono/vite-dev-server

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/vite-dev-server - npm Package Compare versions

Comparing version 0.12.0 to 0.12.1

5

dist/dev-server.js
import { getRequestListener } from "@hono/node-server";
import { minimatch } from "minimatch";
import { createViteRuntime } from "vite";
import { getEnv as cloudflarePagesGetEnv } from "./cloudflare-pages/index.js";

@@ -24,3 +23,2 @@ const defaultOptions = {

const entry = options?.entry ?? defaultOptions.entry;
let runtime;
const plugin = {

@@ -43,6 +41,5 @@ name: "@hono/vite-dev-server",

}
runtime ??= await createViteRuntime(server2);
let appModule;
try {
appModule = await runtime.executeEntrypoint(entry);
appModule = await server2.ssrLoadModule(entry);
} catch (e) {

@@ -49,0 +46,0 @@ return next(e);

6

package.json
{
"name": "@hono/vite-dev-server",
"description": "Vite dev-server plugin for Hono",
"version": "0.12.0",
"version": "0.12.1",
"types": "dist/index.d.ts",

@@ -70,3 +70,3 @@ "module": "dist/index.js",

"glob": "^10.3.10",
"hono": "^4.0.1",
"hono": "^4.2.7",
"playwright": "^1.39.0",

@@ -76,3 +76,3 @@ "publint": "^0.2.5",

"tsup": "^7.2.0",
"vite": "^5.1.1",
"vite": "^5.2.10",
"vitest": "^0.34.6",

@@ -79,0 +79,0 @@ "wrangler": "^3.28.4"

@@ -11,3 +11,3 @@ # @hono/vite-dev-server

- Fast by Vite.
- HMR
- HMR (Only for the client side).
- Plugins are available, e.g., Cloudflare Pages.

@@ -279,2 +279,41 @@ - Also runs on Bun.

### Importing Asset as URL is not working
If you want to [import assets as URL](https://vitejs.dev/guide/assets) with the following code, the `logo` image may not be found.
```tsx
import { Hono } from 'hono'
import logo from './logo.png'
const app = new Hono()
app.get('/', async (c) => {
return c.html(
<html>
<body>
<img src={logo} />
</body>
</html>
)
})
export default app
```
This is because `logo.png` is served from this dev-server, even though it is expected to be served from Vite itself. So to fix it, you can add `*.png` to the `exclude` option:
```ts
import devServer, { defaultOptions } from '@hono/vite-dev-server'
export default defineConfig({
plugins: [
devServer({
entry: 'src/index.tsx',
exclude: [/.*\.png$/, ...defaultOptions.exclude],
}),
],
})
```
## Authors

@@ -281,0 +320,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc