Add HMR Injection
This commit is contained in:
parent
a2ce912ee8
commit
9053ca0b44
3 changed files with 19 additions and 34 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
5
web/public/hmr-runtime-inject.js
Normal file
5
web/public/hmr-runtime-inject.js
Normal 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),
|
||||||
|
};
|
||||||
|
|
@ -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')
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue