fix(devextreme): correctly replace state_manager for cjs#32389
Merged
chaosmirage merged 1 commit intoDevExpress:26_1from Feb 3, 2026
Merged
fix(devextreme): correctly replace state_manager for cjs#32389chaosmirage merged 1 commit intoDevExpress:26_1from
chaosmirage merged 1 commit intoDevExpress:26_1from
Conversation
88a617e to
9a6dc48
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds CommonJS (CJS) support to the state manager module replacement process during the build. Previously, the build script would replace state manager index files with a simple ESM re-export (export * from './prod/index'), but this didn't work correctly for CJS modules. The fix detects CJS files and transpiles the ESM re-export to CJS format using Babel.
Changes:
- Added CJS detection and transpilation logic to correctly replace state manager modules for both ESM and CJS builds
- Improved error handling from console.error to proper callback-based error propagation
- Added comprehensive test coverage for CJS path handling and transformation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
packages/devextreme/build/gulp/state_manager/replace_state_manager_modules_for_production.js |
Added isCjsFile() and transpileToCjs() functions; updated error handling; reformatted entire file with double quotes (inconsistent with codebase convention) |
packages/devextreme/build/gulp/state_manager/__tests__/build_state_manager.test.js |
Added test setup for CJS state manager directories and files; added assertions to verify CJS transformation produces correct CommonJS require syntax |
packages/devextreme/build/gulp/state_manager/replace_state_manager_modules_for_production.js
Show resolved
Hide resolved
packages/devextreme/build/gulp/state_manager/replace_state_manager_modules_for_production.js
Show resolved
Hide resolved
packages/devextreme/build/gulp/state_manager/__tests__/build_state_manager.test.js
Show resolved
Hide resolved
packages/devextreme/build/gulp/state_manager/replace_state_manager_modules_for_production.js
Show resolved
Hide resolved
packages/devextreme/build/gulp/state_manager/replace_state_manager_modules_for_production.js
Show resolved
Hide resolved
mpreyskurantov
approved these changes
Feb 3, 2026
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.
cherry-pick #32386