Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Set up dynamic deployment targets#3

Open
regenrek wants to merge 2 commits intomain from
cursor/set-up-dynamic-deployment-targets-5184
Open

Set up dynamic deployment targets #3
regenrek wants to merge 2 commits intomain from
cursor/set-up-dynamic-deployment-targets-5184

Conversation

@regenrek
Copy link
Contributor

@regenrek regenrek commented Jun 15, 2025

The deployment target can now be dynamically configured via environment variables.

  • The .env.example file was updated to include VITE_DEPLOYMENT_TARGET, allowing users to specify their desired deployment platform (e.g., netlify, vercel, cloudflare-pages, node-server, bun).
  • vite.config.ts was modified to dynamically read the VITE_DEPLOYMENT_TARGET environment variable using loadEnv and pass it as the target option to the tanstackStart plugin. This enables the build process to adapt to the chosen deployment environment.
  • A new file, src/types/deployment.ts, was created to centralize the DeploymentTarget type and an isValidDeploymentTarget utility function. This improves type safety, code organization, and reusability across the codebase.
  • A comprehensive DEPLOYMENT.md guide was added, detailing platform-specific instructions, required dependencies (e.g., unenv for Cloudflare Pages), and configuration files (e.g., app.config.ts, wrangler.toml) for each deployment target.
  • README.md was updated to reference the new DEPLOYMENT.md file, providing clear guidance for users.

This setup allows users to easily switch deployment targets by modifying an environment variable, with platform-specific details documented separately.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Invalid Environment Variable Causes Plugin Errors

The VITE_DEPLOYMENT_TARGET environment variable is unsafely cast to DeploymentTarget without validation. If an invalid value is provided, it is passed directly to the tanstackStart plugin, potentially causing runtime errors. The isValidDeploymentTarget utility function exists but is not used for validation.

vite.config.ts#L11-L18
// Get deployment target from environment variable
const deploymentTarget = env.VITE_DEPLOYMENT_TARGET as DeploymentTarget | undefined;
// Prepare tanstackStart options
const tanstackStartOptions: TanStackStartOptions = {};
if (deploymentTarget) {
tanstackStartOptions.target = deploymentTarget;
}

Fix in Cursor


BugBot free trial expires on June 17, 2025
You have used 1ドル.06 of your 50ドル.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /