Skip to content

How to properly polyfill fetch/XMLHttpRequest in node #586

Open
@flimzy

Description

@flimzy

The compatibility table mentions partial support for 'net/http', saying:

client only, emulated via Fetch/XMLHttpRequest APIs; node.js requires polyfill

But I'm not having any luck figuring out how to get such a polyfill to work. The API detection happens very early in the Go program initialization, such that, as far as I can tell, it is impossible to load a polyfill in time for it to be detected.

Is the only option to prepend GopherJS's output with something like var fetch = require('fetch-node'); before executing it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions