flow icon indicating copy to clipboard operation
flow copied to clipboard

Cannot resolve module node:fs

Open mrtnzlml opened this issue 1 year ago • 1 comments

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

mrtnzlml avatar Apr 28 '23 16:04 mrtnzlml

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

pascalduez avatar May 10 '23 13:05 pascalduez