You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Rollup打包TypeScript生成目标文件后进程不退出,请问如何解决?

问题排查与解决方案

1. 修复CSS插件参数拼写错误

你配置中的rollup-plugin-css-only插件属性存在拼写错误,将output错写为ouput,该错误会导致插件无法完成正常的输出生命周期,持续持有进程资源导致Rollup无法退出:

// 错误写法
css({ ouput: 'dist/index/css' }),
// 修正写法(路径建议直接指定输出文件名,避免目录识别异常)
css({ output: 'dist/index.css' }),

90%以上的同类问题都是该拼写错误导致,修改后重新打包即可正常退出。

2. 调整Typescript插件配置

如果修正拼写问题后依然存在进程常驻的情况,可在@rollup/plugin-typescript参数中显式关闭增量编译,避免类型检查逻辑残留后台进程:

rollupTypescript({
  noEmitOnError: true,
  incremental: false
}),

同时检查你项目根目录的tsconfig.json,确认没有开启watch、incremental这类常驻配置。

3. 显式禁用Rollup监听模式

你还可以在Rollup配置的顶层添加watch: false参数,强制禁用监听逻辑,避免默认配置异常导致进程不退出:

export default {
  input: 'src/index.ts',
  // 新增该行配置
  watch: false,
  output: [
    {
      file: 'dist/index.iife.js',
      format: 'iife',
      name: 'plotter',
    },
  ],
  plugins: [
    rollupTypescript(),
    css({ output: 'dist/index.css' }),
  ],
}

内容的提问来源于stack exchange,提问作者JokerSH

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 11:15:03