DX | 05-08-2026 | Release - #249
Merged
Merged
Conversation
reeshika-h
commented
Aug 5, 2026
Contributor
- v1.5.0 ---> v1.5.1
- fix: Resolve require() incompatibility in ESM and UMD builds
back merge
Three environments broke when keep-alive agents were introduced using
require('http') and require('https'):
1. Native ESM (ReferenceError: require is not defined)
- Added typeof require === 'undefined' guard in createKeepAliveAgent()
- Falls back to false (pre-1.5.0 behaviour) in ESM environments
2. Turbopack/webpack (expression is too dynamic)
- Replaced require(moduleName) variable arg with static string literals
- require('http') / require('https') are statically analysable by bundlers
3. UMD webpack build (Can't resolve 'http')
- Added externals for http and https in config/webpack.config.js
- UMD wrapper resolves them at runtime in Node; isNodeEnvironment guard
prevents execution in browser where they are not available
Tests added:
- test/esm-compat.mjs: native ESM integration test (run after build)
- test/contentstack-core.node-agent.spec.ts: Jest wrapper spawning esm-compat.mjs
- test/esm-exports.spec.ts: static analysis asserting no dynamic require(variable)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… fix Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix: Resolve require() incompatibility in ESM and UMD builds
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
cs-raj
approved these changes
Aug 5, 2026
cs-raj
marked this pull request as ready for review
August 5, 2026 08:59
OMpawar-21
approved these changes
Aug 5, 2026
OMpawar-21
self-requested a review
August 5, 2026 09:00
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
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.