Skip to content

misc/wasm: incorrectly checks for require("fs") validity #40446

Open
@tharvik

Description

@tharvik

When loaded, wasm_exec.js tries to know on which platform it is run. "fs" is loaded if not already available and check if it is empty (when using webpack to provide an empty implementation) or not (when running inside node). The check is wrongly implemented as Object.keys returns an array of key, not a count, thus making that check always true, and unable to use with webpack.

The line in question

if (Object.keys(fs) !== 0) {

Which can be easily fixed by adding a .length after the Object.keys(fs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions