Skip to content

build.mjs reads every binary asset as UTF-8 text before deciding it is not a script #174

Closed

Description

@Nawid3333

Severity: low

Where: build.mjs (spliceAndCopy: const fileText = fs.readFileSync(file, 'utf8'); before the exclude check and the .mjs/.js branch)

What happens

ort-wasm-simd-threaded.wasm, silero_vad_half.onnx, the PNGs and the 3 MB dash.mjs are decoded as UTF-8 into a string that is then discarded, three times per build (three targets in Promise.all). Not a correctness bug (the copy uses copyFileSync), just the single slowest avoidable step of the build.

Suggested fix

Move the readFileSync inside the .mjs/.js branch, after the exclude check.

Confidence: high.


From a line-by-line code review of the tree at 41363fd (2026-10-02). Each claim above was checked against the source before filing; the reproduction steps and line references are as of that commit.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-reviewFound by the 2026-10-02 line-by-line reviewenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions