Merge pull request #13 from Doble-Technologies/bugfix/hmr-changes

Bugfix/hmr changes
This commit is contained in:
Matt DiMeglio 2025-06-12 10:08:14 -04:00 committed by GitHub
commit de07cc03f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 35 deletions

View file

@ -6,6 +6,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=WDXL+Lubrifont+TC&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=WDXL+Lubrifont+TC&display=swap" rel="stylesheet">
<script src="public/hmr-runtime-inject.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ShiftSync</title> <title>ShiftSync</title>
</head> </head>

View file

@ -1,7 +1,7 @@
{ {
"name": "shiftsync-website-web", "name": "shiftsync-website-web",
"private": true, "private": true,
"version": "1.0.2", "version": "1.0.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"local": "vite", "local": "vite",

View file

@ -0,0 +1,5 @@
window.__vite_plugin_hmrOptions = {
protocol: location.protocol === 'https:' ? 'wss' : 'ws',
host: location.hostname,
port: location.port || (location.protocol === 'https:' ? 443 : 80),
};

View file

@ -3,39 +3,18 @@ import react from '@vitejs/plugin-react';
import path from 'path'; import path from 'path';
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig(({ mode = 'local' }) => { export default defineConfig({
const isDev = mode === 'dev'; plugins: [react()],
const isProd = mode === 'prod'; server:{
host: true,
return { allowedHosts: true,
plugins: [react()], cors: true,
server:{ hmr: true
host: true, },
allowedHosts: true, resolve: {
cors: true, alias: {
hmr: isDev '@src': path.resolve(__dirname, 'src'),
? { '@components': path.resolve(__dirname, 'components')
protocol: 'wss',
host: 'shift-dev.code-catalyst.com',
clientPort: 443,
}
: isProd ?
{
protocol: 'wss',
host: 'shift.code-catalyst.com',
clientPort: 443,
}
: {
protocol: 'wss',
host: 'localhost',
clientPort: 443,
},
}, },
resolve: { },
alias: {
'@src': path.resolve(__dirname, 'src'),
'@components': path.resolve(__dirname, 'components')
},
},
}
}); });