From 4a87b85462c55f45de03b701ebcf3412475e2084 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Thu, 26 Jun 2025 06:13:42 +0200 Subject: [PATCH 1/3] Set maxParallelFileOps to 1000 (#5992) This is a quick fix compromise until we find a better solution to enforce the limit. --- docs/configuration-options/index.md | 2 +- src/utils/options/normalizeInputOptions.ts | 7 +++++-- test/function/samples/options-hook/_config.js | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/configuration-options/index.md b/docs/configuration-options/index.md index f828afca2..e902c794d 100755 --- a/docs/configuration-options/index.md +++ b/docs/configuration-options/index.md @@ -637,7 +637,7 @@ Note that when a relative path is directly marked as "external" using the [`exte | -------: | :------------------------------ | | Type: | `number` | | CLI: | `--maxParallelFileOps ` | -| Default: | `Infinity` | +| Default: | 1000 | Limits the number of files rollup will open in parallel when reading modules or writing chunks. Without a limit or with a high enough value, builds can fail with an "EMFILE: too many open files". This depends on how many open file handles the operating system allows. If you set the limit too low and use plugins that rely on the [`this.load`](../plugin-development/index.md#this-load) context function, such as the `commonjs` plugin, then it can happen that builds stall without an error message as it limits the number of parallel `load` calls. diff --git a/src/utils/options/normalizeInputOptions.ts b/src/utils/options/normalizeInputOptions.ts index e35b9cf95..471a450a2 100644 --- a/src/utils/options/normalizeInputOptions.ts +++ b/src/utils/options/normalizeInputOptions.ts @@ -176,8 +176,11 @@ const getMaxParallelFileOps = ( config: InputOptions ): NormalizedInputOptions['maxParallelFileOps'] => { const maxParallelFileOps = config.maxParallelFileOps; - if (typeof maxParallelFileOps !== 'number' || maxParallelFileOps <= 0) return Infinity; - return maxParallelFileOps; + if (typeof maxParallelFileOps === 'number') { + if (maxParallelFileOps <= 0) return Infinity; + return maxParallelFileOps; + } + return 1000; }; const getModuleContext = ( diff --git a/test/function/samples/options-hook/_config.js b/test/function/samples/options-hook/_config.js index 17846fad3..0583b7ffe 100644 --- a/test/function/samples/options-hook/_config.js +++ b/test/function/samples/options-hook/_config.js @@ -11,9 +11,8 @@ module.exports = defineTest({ name: 'test-plugin', buildStart(options) { // The fs option is not json stringifiable - const { fs, maxParallelFileOps, ...restOptions } = options; + const { fs, ...restOptions } = options; assert.ok(fs); - assert.strictEqual(maxParallelFileOps, Infinity); assert.deepStrictEqual(JSON.parse(JSON.stringify(restOptions)), { context: 'undefined', experimentalCacheExpiry: 10, @@ -22,6 +21,7 @@ module.exports = defineTest({ jsx: false, logLevel: 'info', makeAbsoluteExternalsRelative: 'ifRelativeSource', + maxParallelFileOps: 1000, perf: false, plugins: [ { From 5a7f9e215a11de165b85dafd64350474847ec6db Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Thu, 26 Jun 2025 06:16:24 +0200 Subject: [PATCH 2/3] 4.44.1 --- CHANGELOG.md | 13 +++++++++++++ browser/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 570a30d8f..f6c229fa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # rollup changelog +## 4.44.1 + +_2025-06-26_ + +### Bug Fixes + +- Reinstate maxParallelFileOps limit of 1000 to resolve the issue for some (#5992) + +### Pull Requests + +- [#5988](https://github.com/rollup/rollup/pull/5988): fix(deps): lock file maintenance minor/patch updates (@renovate[bot], @lukastaegert) +- [#5992](https://github.com/rollup/rollup/pull/5992): Set maxParallelFileOps to 1000 (@lukastaegert) + ## 4.44.0 _2025-06-19_ diff --git a/browser/package.json b/browser/package.json index 07e9d89c6..8b40bfff6 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "4.44.0", + "version": "4.44.1", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/package-lock.json b/package-lock.json index b6d25710e..15bc2397c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "4.44.0", + "version": "4.44.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup", - "version": "4.44.0", + "version": "4.44.1", "license": "MIT", "dependencies": { "@types/estree": "1.0.8" diff --git a/package.json b/package.json index a87d5f8fb..7b24be89e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "4.44.0", + "version": "4.44.1", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From 23ac27f0b56f6041dd41749e8c17e5abc70246f9 Mon Sep 17 00:00:00 2001 From: waynzh Date: Fri, 27 Jun 2025 15:49:43 +0800 Subject: [PATCH 3/3] docs(cn): resolve conflicts --- docs/configuration-options/index.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/configuration-options/index.md b/docs/configuration-options/index.md index ab177bbc7..dc17d7138 100755 --- a/docs/configuration-options/index.md +++ b/docs/configuration-options/index.md @@ -633,19 +633,11 @@ buildWithCache() ### maxParallelFileOps {#maxparallelfileops} -<<<<<<< HEAD | | | | -----: | :------------------------------ | | 类型: | `number` | | CLI: | `--maxParallelFileOps ` | -| 默认: | `Infinity` | -======= -| | | -| -------: | :------------------------------ | -| Type: | `number` | -| CLI: | `--maxParallelFileOps ` | -| Default: | 1000 | ->>>>>>> 5a7f9e215a11de165b85dafd64350474847ec6db +| 默认: | 1000 | 该选项限制 rollup 在读取模块或写入 chunk 时,同时能打开的文件数量。如果没有限制或者数值足够高,构建可能会失败,显示“EMFILE: Too many open files”(EMFILE:打开的文件数过多)。这取决于操作系统限制的句柄数(open file handles)大小。如果将限制设置得过低,并且使用了依赖 [`this.load`](../plugin-development/index.md#this-load) 上下文函数的插件(例如 `commonjs` 插件),那么可能会出现构建停滞且没有错误消息的情况,因为它限制了并行 `load` 调用的数量。