Skip to content

feat: configure NODE_ENV across bundlers #3642

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

Merged
merged 2 commits into from
Apr 18, 2025

Conversation

ryan-mars
Copy link
Contributor

Add environment variable propagation through build chain, with development defaults for DevBundler and production defaults for standard bundling. Includes comprehensive test coverage.

Description

This PR fixes an issue where the bundler hardcoded process.env.NODE_ENV to "production" during all builds. The fix allows the actual environment NODE_ENV to be respected during development while maintaining production defaults for standard bundling. I've implemented the solution as suggested by @wardpeet by adding an env option to the bundler chain.

Related Issue(s)

#3610

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test update

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have generated a changeset for this PR

Copy link

codesandbox bot commented Apr 15, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

changeset-bot bot commented Apr 15, 2025

🦋 Changeset detected

Latest commit: 248c4d4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@mastra/deployer Patch
mastra Patch
@mastra/deployer-cloudflare Patch
@mastra/deployer-netlify Patch
@mastra/deployer-vercel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Apr 15, 2025

@ryan-mars is attempting to deploy a commit to the Mastra Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

promptless bot commented Apr 15, 2025

✅ No documentation updates required.

ryan-mars and others added 2 commits April 18, 2025 01:42
Add environment variable propagation through build chain, with development defaults for DevBundler and production defaults for standard bundling. Includes comprehensive test coverage.
Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

Thanks a lot! 🙏 Looks good

@wardpeet wardpeet force-pushed the fix/3610-respect-node-env branch from 4d7a783 to 248c4d4 Compare April 18, 2025 00:09
@wardpeet wardpeet merged commit 735ead7 into mastra-ai:main Apr 18, 2025
10 of 19 checks passed
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.

2 participants