Skip to content

Commit

Permalink
dev:reload
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed May 22, 2024
1 parent c958b7f commit f860da5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"start": "electron-forge start -- --devtools",
"frontend": "electron-forge start -- --remote-backend=http://127.0.0.1:8000 --devtools",
"dev": "concurrently \"npm run dev:py\" \"electron-forge start -- --remote-backend=http://127.0.0.1:8000 --refresh --devtools\"",
"dev:reload": "concurrently \"npm run dev:py\" \"cross-env HOT_RESTART=1 electron-forge start -- --remote-backend=http://127.0.0.1:8000 --refresh --devtools\"",
"dev:profile": "concurrently \"npm run dev:py:profile\" \"electron-forge start -- --remote-backend=http://127.0.0.1:8000 --refresh --devtools\"",
"dev:py": "cd backend/src && cross-env CHECK_LEVEL=fix nodemon --exec \"python -m debugpy --listen 5678\" ./run.py 8000",
"dev:py:profile": "cd backend/src && cross-env CHECK_LEVEL=fix nodemon --exec \"python ./run.py 8000 --trace",
Expand Down
14 changes: 12 additions & 2 deletions vite/main.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import os from 'os';
import ignore from 'rollup-plugin-ignore';
import { defineConfig, mergeConfig } from 'vite';
import { external, getBuildConfig, getBuildDefine } from './base.config';
import { external, getBuildConfig, getBuildDefine, pluginHotRestart } from './base.config';
import type { ConfigEnv, UserConfig } from 'vite';
import './forge-types';

const restart = process.env.HOT_RESTART !== undefined;

// https://vitejs.dev/config
export default defineConfig((env) => {
const forgeEnv = env as ConfigEnv<'build'>;
Expand All @@ -28,7 +30,10 @@ export default defineConfig((env) => {
},
},
},
plugins: os.platform() === 'darwin' ? [ignore(['fsevents'])] : [],
plugins: [
...(restart ? [pluginHotRestart('restart')] : []),
...(os.platform() === 'darwin' ? [ignore(['fsevents'])] : []),
],
define,
resolve: {
// Load the Node.js entry.
Expand All @@ -40,6 +45,11 @@ export default defineConfig((env) => {
},
conditions: ['node', 'default'],
},
server: {
watch: {
ignored: ['**/translation.json'],
},
},
};

return mergeConfig(getBuildConfig(forgeEnv), config);
Expand Down

0 comments on commit f860da5

Please sign in to comment.