Skip to content

Conversation

@regenrek
Copy link
Contributor

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants