honojs/vite-plugins

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

genesem opened this issue · 2 comments

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.

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!

Fixed by #13