facebook / flow

Adds static typing to JavaScript to improve developer productivity and code quality.
https://flow.org/
MIT License
22.09k stars 1.85k forks source link

Cannot resolve module node:fs #9028

Open mrtnzlml opened 1 year ago

mrtnzlml commented 1 year ago

Missing/Incorrect APIs

Flow doesn't support node: imports such as:

import fs from 'node:fs';

Currently, the following error is thrown:

Cannot resolve module node:fs. [cannot-resolve-module]

The only supported syntax is the original version without node: prefix:

import fs from 'fs';

This affects all Node.js imports, not just fs.

Relevant documentation

See: https://nodejs.org/api/esm.html#node-imports

pascalduez commented 1 year ago

Hi, as a temporary (or not so temporary) solution you could install flow-typed node environment.
https://flow-typed.github.io/flow-typed/#/env-definitions