mirror of
https://github.com/lukaszraczylo/beat-delivery-methodology.git
synced 2026-11-26 11:08:13 +00:00
feat(build): generate the 404 fallback from the current build
The SPA fallback must load the hashed assets of the build that is actually published, so it cannot be a frozen copy of an index document. The new scripts/generate-404.mjs writes dist/404.html from the built dist/index.html and runs last in the build, after vite build has copied publicDir. The generator resolves the dist directory from its own location, so it behaves the same from the repository root and from public/, where npm runs it. It refuses to write a fallback that has no app mount point or that references files missing from the build output, so a broken build fails loudly instead of shipping a blank page. The two frozen copies (public/404.html, public/public/404.html) are removed; dist/404.html is a generated artefact with no committed source copy.
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"build": "vite build && node ../scripts/generate-404.mjs",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user