Skip to content

fix(build): bundle localforage without its Promise polyfill - #716

Merged
Quorafind merged 1 commit into
masterfrom
fix/no-runtime-script-element
Nov 28, 2026
Merged

Quorafind merged 1 commit into
masterfrom
fix/no-runtime-script-element

Conversation

@Quorafind

Copy link
Copy Markdown
Member

Obsidian's automated review failed 10.1.0 with one Error: Code obfuscation — Code creates script elements at runtime (createElement('script')).

The source comes from a dependency, not from our code. localforage's default build (dist/localforage.js) bundles the lie Promise polyfill, and its immediate scheduler falls back to creating <script> elements (an old IE trick).

This aliases localforage to localforage/dist/localforage.nopromises.js in esbuild. That build is the same localforage 1.10.0 without the polyfill, and Obsidian's Electron has native Promise. Source, types and jest mocks are unchanged.

Checked: the rebuilt main.js contains no createElement("script") and no onreadystatechange.

localforage's default build bundles the lie Promise polyfill, whose immediate fallback creates <script> elements at runtime. Obsidian's automated review flags that as an error (code obfuscation) and failed 10.1.0. Alias localforage to its nopromises build; Obsidian's Electron has native Promise.
@Quorafind
Quorafind merged commit a3a1dd7 into master Nov 28, 2026
3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant