fix: swap mismatched console.log calls in importing_bytes example#3117
Conversation
The static `import bytes` was followed by `console.log(text)` (TDZ), and the dynamic `const text` was followed by `console.log(bytes)`. Swap them so each log matches its preceding import. Closes #3044
|
The |
fibibot
left a comment
There was a problem hiding this comment.
Diff swap is correct. Pre-fix, line 20 console.log(text) hits the TDZ (the const text is on line 23), and line 26 console.log(bytes) logs the static-import value under a comment that introduces dynamic imports. After the swap, each console.log references the binding immediately above it, which is the intent. The diff is also intentionally minimal — no rename of text (which still holds the dynamic-import namespace object, not bytes), matching the reporter's request in #3044.
Holding approval until lint and link check finishes. The currently-failing run is the same /styleguide/typography.mdx "Cannot resolve module 'lume/jsx-runtime'" build error affecting other open PRs (e.g. #3107), not anything in examples/scripts/importing_bytes.ts.
Summary
The
/examples/importing_bytes/snippet logs the wrong variable in both halves of the example. As pointed out by the reader in #3044:textimmediately afterimport bytes from "./image.png"—textis not defined yet (TDZ).bytesafterconst text = await import(...)— should logtext.Swap the two
console.logarguments so each log matches its preceding import. Variable names are left as-is to keep the diff minimal, per the reporter's request.Test plan
console.logcalls now reference variables that exist at that point in the program.Closes #3044
Closes bartlomieju/orchid-inbox#61
cc @bartlomieju