-
Notifications
You must be signed in to change notification settings - Fork 334
Migrate build system to esbuild and add environment validation #1234
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace rollup with esbuild bundler for all client libraries, improve TypeScript configurations, and introduce Zod-based environment variable validation for console webapp with separate client/server schemas. Fix Next.js env var inlining in clientEnv by using explicit property access instead of passing process.env object to Zod.
fix(all) remove unused libs fix(all) remove node-fetch
# Conflicts: # libs/jitsu-js/package.json # package.json # pnpm-lock.yaml
…. instead fallback to clientEnv
…vy deps directly into rotor
Feat/newjitsu/functions server
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modernizes the build tooling for client libraries and adds runtime environment variable
validation to the console webapp. The changes improve build performance, reduce bundle sizes,
and provide type-safe environment configuration with clear error messages.
The existing build setup had several issues affecting development experience and reliability:
cryptic runtime failures
Build System Migration
Replaced rollup with esbuild bundler across all client libraries (jitsu-js, jitsu-react, functions).
esbuild provides significantly faster builds with minimal configuration. Created
bundle.mtsfilesthat handle multiple output formats: ESM, CJS, and browser IIFE bundles with proper tree-shaking
and sourcemaps.
Updated TypeScript configurations to use modern settings with proper module resolution and removed
test-specific tsconfig files. Cleaned up package.json files to align with new build approach.
Environment Validation
Introduced Zod-based validation for
consolewebapp environment variables with two separateschemas:
serverEnv.ts- comprehensive schema for all server-side config (database, ClickHouse, Redis,auth providers, etc.) with detailed comments explaining each variable
clientEnv.ts- minimal schema for browser-safe NEXT_PUBLIC_* variablesBoth schemas provide startup validation with clear error messages indicating exactly which
variables are missing or misconfigured. The client schema explicitly accesses each env var to
ensure Next.js can properly inline them at build time (passing process.env object directly won't
work in browser).
Cleanup
Removed deprecated react-app example that was no longer maintained and removed test-specific
TypeScript configs that are no longer needed with improved build setup.
Breaking Changes
Environment variables are now validated at startup. If your deployment has missing or misconfigured
variables, the application will fail to start with a clear error message instead of failing
silently at runtime.