Description
Version
npmPackages:
@rsbuild/core: 1.4.5 => 1.4.5
Details
Running Rsbuild >= 1.4.2 with Node.js 16.10.0 results in the following error:
node_modules/@rsbuild/core/dist/index.js:20
import promises, { constants as promises_constants } from "node:fs/promises";
^^^^^^^^^
SyntaxError: The requested module 'node:fs/promises' does not provide an export named 'constants'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:179:5)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async main (node_modules/@rsbuild/core/bin/rsbuild.js:16:22)
The reason is that the node:fs/promises
module only exports constants
starting from Node.js versions 16.17.0 and 18.4.0 (reference).
The current workaround is to use a patch for node_modules/@rsbuild/core/dist/index.js
that includes this:
-import promises, { constants as promises_constants } from "node:fs/promises";
+import promises from "node:fs/promises";
+import { constants as promises_constants } from 'node:fs';
Reproduce link
(unnecessary, see commands below)
Reproduce Steps
npm init -y
npm i -D @rsbuild/core
nvm install 16.10.0
npx rsbuild
Metadata
Metadata
Assignees
Labels
No labels