chore: switch to react-router v7

This commit is contained in:
Aarnav Tale
2024-12-31 10:30:14 +05:30
parent 39504e2487
commit aa9872a45b
101 changed files with 3825 additions and 6796 deletions
+15 -15
View File
@@ -1,12 +1,12 @@
// This is a polyglot entrypoint for Headplane when running in development
// It does some silly magic to load the vite config, set some globals that
// are required to function, and create the vite development server.
import { createServer } from 'vite'
import { env, exit } from 'node:process'
import { log } from './utils.mjs'
import { createServer } from 'vite';
import { env, exit } from 'node:process';
import { log } from './utils.mjs';
log('DEVX', 'INFO', 'This script is only intended for development')
env.NODE_ENV = 'development'
log('DEVX', 'INFO', 'This script is only intended for development');
env.NODE_ENV = 'development';
// The production entrypoint uses a global called "PREFIX" to determine
// what route the application is being served at and a global called "BUILD"
@@ -14,20 +14,20 @@ env.NODE_ENV = 'development'
// the development server can function correctly and override the production
// values.
log('DEVX', 'INFO', 'Creating Vite Development Server')
log('DEVX', 'INFO', 'Creating Vite Development Server');
const server = await createServer({
server: {
middlewareMode: true
}
})
middlewareMode: true,
},
});
// This entrypoint is defined in the documentation to load the server
const build = await server.ssrLoadModule('virtual:remix/server-build')
const build = await server.ssrLoadModule('virtual:react-router/server-build');
// We already handle this logic in the Vite configuration
global.PREFIX = server.config.base.slice(0, -1)
global.BUILD = build
global.MODE = 'development'
global.MIDDLEWARE = server.middlewares
global.PREFIX = server.config.base.slice(0, -1);
global.BUILD = build;
global.MODE = 'development';
global.MIDDLEWARE = server.middlewares;
await import('./prod.mjs')
await import('./prod.mjs');