-
Notifications
You must be signed in to change notification settings - Fork 1
feat: restore configurable hotfile option #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add back the hotfile feature that was removed in commit 588863c. The hotfile is now configurable and can be disabled by setting hotFile to false. The hotfile allows Spring applications to detect when the Vite dev server is running by checking for the existence of the file, which contains the dev server URL. Changes: - Add hotFile option to VitePluginJavaConfig (string | false) - Write hotfile on server start with dev server URL - Clean up hotfile on process exit - Update .gitignore to ignore hot file - Update README with hotfile documentation Closes #2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR restores the hotfile feature for the Vite Java plugin, allowing Spring applications to detect when the Vite dev server is running by checking for a hotfile containing the server URL.
- Adds configurable
hotFileoption that can be set to a custom path or disabled withfalse - Automatically writes hotfile on server start and cleans it up on process exit
- Updates documentation with hotfile configuration examples
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/vite-plugin-java/src/vite-plugin-java.ts | Implements hotfile writing on server start and cleanup on exit |
| packages/vite-plugin-java/src/index.ts | Adds hotFile configuration option to the interface |
| packages/vite-plugin-java/README.md | Documents the new hotFile configuration option with examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| process.on('SIGINT', () => process.exit()) | ||
| process.on('SIGTERM', () => process.exit()) | ||
| process.on('SIGHUP', () => process.exit()) |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cleanup function should also be called for the other process exit handlers to ensure the hotfile is cleaned up in all exit scenarios.
| process.on('SIGINT', () => process.exit()) | |
| process.on('SIGTERM', () => process.exit()) | |
| process.on('SIGHUP', () => process.exit()) | |
| process.on('SIGINT', () => { clean(); process.exit() }) | |
| process.on('SIGTERM', () => { clean(); process.exit() }) | |
| process.on('SIGHUP', () => { clean(); process.exit() }) |
| process.on('SIGINT', () => process.exit()) | ||
| process.on('SIGTERM', () => process.exit()) | ||
| process.on('SIGHUP', () => process.exit()) |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These signal handlers should call the cleanup function before exiting to ensure the hotfile is removed when the process is terminated by signals.
| process.on('SIGINT', () => process.exit()) | |
| process.on('SIGTERM', () => process.exit()) | |
| process.on('SIGHUP', () => process.exit()) | |
| process.on('SIGINT', () => { clean(); process.exit() }) | |
| process.on('SIGTERM', () => { clean(); process.exit() }) | |
| process.on('SIGHUP', () => { clean(); process.exit() }) |
Summary
This PR restores the hotfile feature that was removed in commit 588863c, addressing issue #2. The hotfile is now configurable and can be disabled by setting
hotFiletofalse.Why is this needed?
The hotfile allows Spring applications to detect when the Vite dev server is running. Spring can check for the existence of this file to determine whether to:
Changes
hotFileconfiguration option toVitePluginJavaConfig(string | false).gitignoreto ignore thehotfileConfiguration
The hotfile is enabled by default at
public/hot, but can be customized or disabled:```typescript
java({
input: 'src/main.ts',
hotFile: 'static/hot', // Custom path
// or
hotFile: false, // Disable hotfile generation
})
```
Test Plan
Closes #2
🤖 Generated with Claude Code