fix: replace Node.js Buffer APIs with browser-native alternatives#2028
Merged
caio-pizzol merged 8 commits intomainfrom Feb 14, 2026
Merged
Conversation
Reverts the vite.config.umd.js changes from 13fa579. Buffer usage will be replaced with browser-native APIs instead of polyfilling.
Buffer.from, Buffer.isBuffer, and buffer-crc32 crash in browser/CDN environments. Use Uint8Array, ArrayBuffer.isView, TextEncoder, and a custom CRC32 table instead.
…onfig The generic `process` define wasn't replacing `process.env.NODE_ENV` member accesses in the bundle, causing "process is not defined" at runtime. Targeting the specific path fixes it and enables dead-code elimination (~110KB smaller bundle).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb320d65e9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Media values from #exportProcessMediaFiles are ArrayBuffers (via getArrayBufferFromUrl), not base64 strings. Only call base64ToUint8Array for string values to avoid crashing atob with binary input.
- Remove vite-plugin-node-polyfills from UMD external/globals (build-time plugin, never imported at runtime) - Reuse base64ToUint8Array from helpers.js in metafile-converter instead of duplicating the atob+charCodeAt loop
Verify output matches buffer-crc32 with known reference values to prevent silent breakage of document fingerprinting.
Pin generateContentHash and generateIdentifierHash to exact expected values instead of pattern matching. Add exportFromCollaborativeDocx test covering both base64 string and ArrayBuffer media values.
caio-pizzol
added a commit
that referenced
this pull request
Feb 14, 2026
) * revert: remove nodePolyfills from UMD build Reverts the vite.config.umd.js changes from 13fa579. Buffer usage will be replaced with browser-native APIs instead of polyfilling. * fix: replace Node.js Buffer APIs with browser-native alternatives Buffer.from, Buffer.isBuffer, and buffer-crc32 crash in browser/CDN environments. Use Uint8Array, ArrayBuffer.isView, TextEncoder, and a custom CRC32 table instead. * fix(build): replace process define with process.env.NODE_ENV in UMD config The generic `process` define wasn't replacing `process.env.NODE_ENV` member accesses in the bundle, causing "process is not defined" at runtime. Targeting the specific path fixes it and enables dead-code elimination (~110KB smaller bundle). * fix: handle binary media values in collaborative export Media values from #exportProcessMediaFiles are ArrayBuffers (via getArrayBufferFromUrl), not base64 strings. Only call base64ToUint8Array for string values to avoid crashing atob with binary input. * refactor: remove dead externals config and consolidate base64 decode - Remove vite-plugin-node-polyfills from UMD external/globals (build-time plugin, never imported at runtime) - Reuse base64ToUint8Array from helpers.js in metafile-converter instead of duplicating the atob+charCodeAt loop * test: add CRC32 parity tests for computeCrc32Hex Verify output matches buffer-crc32 with known reference values to prevent silent breakage of document fingerprinting. * test: add base64ToUint8Array unit tests * test: pin hash values and add mixed media export test Pin generateContentHash and generateIdentifierHash to exact expected values instead of pattern matching. Add exportFromCollaborativeDocx test covering both base64 string and ArrayBuffer media values.
|
🎉 This PR is included in superdoc v1.13.0-next.14 The release is available on GitHub release |
superdoc-bot bot
pushed a commit
that referenced
this pull request
Feb 14, 2026
# [1.13.0](v1.12.0...v1.13.0) (2026-02-14) ### Bug Fixes * anchor table overlaps text ([#1995](#1995)) ([fc05e29](fc05e29)) * collaboration cursor styles fix ([fd6db10](fd6db10)) * ensure we do not duplicate bubble text ([#1934](#1934)) ([c41cf9e](c41cf9e)) * ignore sdBlockId when pasting content ([#2010](#2010)) ([1b08572](1b08572)) * normalize bookmarks in tables ([#1892](#1892)) ([369b7e1](369b7e1)) * replace Node.js Buffer APIs with browser-native alternatives ([#2028](#2028)) ([b17774a](b17774a)), closes [#exportProcessMediaFiles](https://github.com/superdoc-dev/superdoc/issues/exportProcessMediaFiles) * use correct template syntax for GitHub release URL in PR comments ([9d1bca2](9d1bca2)) ### Features * enabled telemetry by default and added documentation ([#2001](#2001)) ([8598ef7](8598ef7)) * enhance telemetry handling for sub-editors ([#2017](#2017)) ([37bc030](37bc030)) * update telemetry configuration to prioritize root licenseKey ([#2016](#2016)) ([3b4ff6b](3b4ff6b))
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.
No description provided.