test - #565
Closed
Ryan-Millard wants to merge 2 commits into
Closed
Conversation
…vailable
The CJS build (dist/node/img2num.cjs) crashed on Node < 22.12 instead of
converting. Two causes:
1. src/target/node/webgpu.js statically imported the ESM-only `webgpu`
package. Rolldown compiles static imports of externals in the CJS
output to a top-level require("webgpu"), which throws ERR_REQUIRE_ESM
on Node < 22.12 (Node >= 22.12 supports require(esm), masking the bug
in dev). The import is now dynamic, which Rolldown preserves as a real
import() in CJS output.
2. When the webgpu import rejects (ERR_REQUIRE_ESM, or the optional
dependency not installed, e.g. --ignore-optional), initWasmModule
logged "should fall back to CPU" but initialized the wasm anyway with
no globalThis.navigator. The Emscripten glue dereferences `navigator`
unconditionally, so the conversion died with "navigator is not
defined" instead of falling back. The catch block now installs a stub
navigator.gpu whose requestAdapter() resolves null, routing the glue
to its CPU path.
Adds a generateBundle guard (cjsWebgpuGuard) for the node-cjs target
that fails the build if any emitted chunk contains an executable
require("webgpu"), so a future bundler change cannot silently lower the
dynamic import back into the broken form (same class of regression as
the v0.4.0 wasm URL inlining).
Verified: guard fails the build when the static import is reintroduced;
with node_modules/webgpu removed, both ESM and CJS console examples
fall back to CPU and produce the SVG; with webgpu present, the CJS
entry now initializes the GPU identically to ESM.
This comment was marked as outdated.
This comment was marked as outdated.
Owner
Author
|
This PR proves that the failures of #562's CI runs are not already in Very strange errors in the PR that seem to have been resolved now: https://github.com/Ryan-Millard/Img2Num/actions/runs/31968459437/job/95780256675?pr=562 Either a GitHub issue or something worth a deeper look. Either way, a proper diagnosis is required. |
Comment-stripping with a regex mis-lexes double forward-slash nside string literals (URLs) and could hide an executable require of webgpu. The guard now matches raw chunk code; the source JSDoc no longer contains the matchable pattern, so any hit is executable. Addresses CodeRabbit review on the guard's false-negative case.
Ryan-Millard
force-pushed
the
test-python-failure
branch
2 times, most recently
from
August 18, 2026 17:27
d750c88 to
8cabd9f
Compare
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.
This is a test for #562's failed workflow run. @coderabbitai, please don't review this.