File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { defineConfig } from 'vite'
22import react from '@vitejs/plugin-react'
33import tailwindcss from '@tailwindcss/vite'
4- import * as fs from 'node:fs'
5- import * as path from 'node:path'
64
75// https://vite.dev/config/
86export default defineConfig ( {
9- plugins : [
10- react ( ) ,
11- tailwindcss ( ) ,
12- // Plugin to copy index.html to 404.html for GitHub Pages SPA routing
13- {
14- name : 'copy-index-to-404' ,
15- closeBundle ( ) {
16- try {
17- const distPath = path . resolve ( 'dist' )
18- const indexPath = path . join ( distPath , 'index.html' )
19- const notFoundPath = path . join ( distPath , '404.html' )
20-
21- if ( fs . existsSync ( indexPath ) ) {
22- fs . copyFileSync ( indexPath , notFoundPath )
23- // eslint-disable-next-line no-console
24- console . log ( '✅ Copied index.html to 404.html for GitHub Pages SPA routing' )
25- }
26- } catch ( error ) {
27- // eslint-disable-next-line no-console
28- console . warn ( '⚠️ Failed to copy index.html to 404.html:' , error )
29- }
30- }
31- }
32- ] ,
7+ plugins : [ react ( ) , tailwindcss ( ) ] ,
338 base : '/' , // Set to '/' since we'll use a custom domain
349 build : {
3510 outDir : 'dist' ,
You can’t perform that action at this time.
0 commit comments