Skip to content

--no-experimental-fetch does not disable fetch #45580

@elikmiller

Description

@elikmiller

Version

v18.12.1

Platform

Linux 5.15.0-53-generic #59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

fetch

What steps will reproduce the bug?

Running node with the --no-experimental-fetch flag does not result in fetch being unavailable at runtime.

console.log(process.argv);
console.log(global.fetch);

global
  .fetch("https://github.com")
  .then((res) => res.text())
  .then(console.log);

How often does it reproduce? Is there a required condition?

Happens every time

What is the expected behavior?

Would expect that global.fetch to not be defined

[
  '/usr/local/bin/node',
  '/home/eli/Desktop/test.js',
  '--no-experimental-fetch'
]
[AsyncFunction: fetch]
/home/eli/Desktop/test.js:6
  .fetch("https://google.com")
   ^

TypeError: global.fetch is not a function
...

What do you see instead?

[
  '/usr/local/bin/node',
  '/home/eli/Desktop/test.js',
  '--no-experimental-fetch'
]
[AsyncFunction: fetch]
(node:204954) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"> ...

Additional information

No response

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