Rolldown 1.3.0 发布:preserveModules 文件名改为 Rollup 语义,Vite 用户不要用 overrides 强行升级
Rolldown v1.3.0 是一个 minor release,发布日期为 2026-11。Release 页面见 rolldown/rolldown v1.3.0。
Vite 用户:不要通过 overrides / resolutions 强行升级
官方特别提醒:不要通过 overrides 或 resolutions 强制把 rolldown@1.3.0 注入 Vite。Vite 8.3.6 及更早版本需要修改代码才能与该版本配合工作。
Vite 会锁定自己使用的 rolldown 版本,正常安装不受影响;等待支持 Rolldown 1.3 的 Vite 版本发布后再升级即可。
新增:实验性 import attributes 支持
该版本实验性支持 import attributes(遵循 Rollup 5 的设计),默认关闭。
默认关闭的原因:开启后会改变带属性导入模块的 id;把 id 当作文件路径使用的插件可能因此失效。另外,Rolldown 的 dev 模式与 Vite 目前都不支持该特性。
破坏性变更
1. preserveModules 文件名遵循 Rollup 语义(#11410、#11413)
[name] 现在会保留非 JS 扩展名:
data.json输出为data.json.js(此前为data.js)Comp.vue输出为Comp.vue.js(此前为Comp.js)
把 exports 指向旧文件名的库需要相应更新。
2. CLI:--input 不能与位置参数入口混用(#11445)
rolldown 1.js --input 2.js
以上写法现在会报错。改用纯位置参数或纯 --input:
rolldown 1.js 2.js
rolldown --input 1.js --input 2.js
值得注意的修复:外部导入保留属性(#11302、#11303)
外部导入现在能正确保留其属性,无论是否开启 experimental.importAttributes。
此前,同一外部模块带不同属性的两次导入会被合并为一个模块,导致其中一次导入丢失;旧的 assert 关键字也会被复制到输出中,而 Node.js 22+ 无法加载这种输出。
输入示例:
import 'ext';
import 'ext' with { type: 'json' };
import data from 'ext2' assert { type: 'json' };
1.2.16 输出(第一次 import 'ext' 丢失):
import 'ext' with { type: 'json' };
import data from 'ext2' assert { type: 'json' };
1.3.0 输出(带 DEPRECATED_IMPORT_ASSERTION 警告):
import 'ext';
import 'ext' with { type: 'json' };
import data from 'ext2' with { type: 'json' };
插件现在可在 this.getModuleIds() 中看到这类外部模块的 id 携带属性,例如:
ext?attributes=%7B%22type%22%3A%22json%22%7D
其他
该版本还包含大量 tree-shaking、sourcemap、watch 模式与 Vite 相关插件的修复,以及若干性能优化与文档更新。