Uglify ascii option - #744
Merged
Merged
Conversation
fuzzie360
added a commit
that referenced
this pull request
Jul 27, 2026
Step two of the build modernization, and the last of browserify. The pilot in @gpujs/benchmark covered the plain case; this covers the three things unique to gpu.js. bundle browserify rolldown gzip gpu-browser.js 118770 116126 -2.2% gpu-browser-core.js 77352 75740 -2.1% gpu-browser.min.js 95906 93080 -2.9% gpu-browser-core.min.js 63277 60213 -4.8% `gl`, and acorn for the core build, are aliased to an empty module rather than marked external: external would leave a require() in the bundle that throws in a browser, where .ignore() substituted a stub. The bundle now gets an ascii pass. acorn ships its unicode identifier tables already escaped and browserify emitted them verbatim, but rolldown decodes string literals and prints the characters — 68732 raw UTF-8 bytes in dist/gpu-browser.js. Serving that without a matching charset corrupts acorn's identifier regex, which is what #743 and #744 were. terser does the escaping rather than a regex sweep, because it parses the code and so only escapes where an escape is equivalent. All four artifacts are ASCII-clean, as they were before. Verified against the browserify bundle: identical export surface (20 named exports, 6 static flags), the #639 write-swallowing global setter intact, kernels producing the same values, 9/9 BrowserStack targets on both the smoke and visual suites, and the real QUnit suite in Chrome giving 90 passed / 3 failed / 18 skipped from both bundles — the three being the pre-existing node-only test files that cannot load in a browser. Installed packages 451 -> 304, and 717 before this work started. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Closes #743