honojs / vite-plugins

Vite Plugins for Hono
https://hono.dev
134 stars 35 forks source link

Static assets from '/public/' dir does not handled #2

Closed genesem closed 1 year ago

genesem commented 1 year ago

Static assets from '/public/' dir does not handled well. i.e. having file in '/public/robots.txt' does not work as expected, it produces 404 error as it 's intercepted by this dev. server plugin but not vite.

temp workaround atm. was using option:

exclude: ['.*.ts', '.*.tsx', '/@.+', '/node_modules/.*', '/inc/.*', '.*.txt', '.*.ico' ], - added exlude paths.

yusukebe commented 1 year ago

Hi @genesem !

As you do, we should use the exclude field to handle a /public or others:

import { defaultOptions } from '@hono/vite-dev-server'
import devServer from '@hono/vite-dev-server'

export default defineConfig({
  plugins: [devServer({
    exclude: [...defaultOptions.exclude, "*.ico", "/app/.+"],
  })]
})

With #3, the files to ignore are hard coded. We must not do that. Anyway, thanks!

yusukebe commented 1 year ago

Fixed by #13