vite-plugins icon indicating copy to clipboard operation
vite-plugins copied to clipboard

build: `_routes.json` is not regenerated by `emptyOutDir: false.`

Open akku1139 opened this issue 9 months ago • 2 comments

build and cloudflare-pages set the Vite build.emptyOutDir to false. https://github.com/honojs/vite-plugins/commit/e125070ca85d8a961db65980cba3476a5b9b8abf https://github.com/honojs/vite-plugins/blob/ee81be5695b60a6fc7b96256b6eee37b09839697/packages/build/src/base.ts#L38

This means that _routes.json is always in dist/, so adding/removing files/directories to the public directory will not be applied to _routes.json. https://github.com/honojs/vite-plugins/blob/ee81be5695b60a6fc7b96256b6eee37b09839697/packages/build/src/adapter/cloudflare-pages/index.ts#L30-L33

However, when generating a client, emptyOutDir: false. is required. https://github.com/honojs/vite-plugins/blob/main/packages/build/README.md#build-a-client

akku1139 avatar May 02 '25 04:05 akku1139

so adding/removing files/directories to the public directory will not be applied to _routes.json.

Also, note that even if you remove a file/directory from public/ it still exists in dist/.

akku1139 avatar May 02 '25 04:05 akku1139

Hi @akku1139

Sorry for being late. I think this can be fixed with #270. Can you review this PR?

yusukebe avatar May 30 '25 20:05 yusukebe