When using Vite 5 with a backend framework like Flask, you may need the manifest.json file placed outside the build output directory to prevent it from being URL-accessible. Vite (via Rollup) does not support relative paths in the manifest config option. Two workarounds are presented: the simple approach of appending a shell `mv` command to the build script in package.json, and a more robust approach of writing a custom Vite plugin that uses the `writeBundle` hook to rename/move the manifest file after the build completes. The plugin approach is more maintainable when output directory or manifest filenames change.

5m read timeFrom playfulprogramming.com
Post cover image
Table of contents
The easy way: Add a mv command to the build script Copy link Link copied!The hard way: writing a Vite plugin Copy link Link copied!

Sort: