diff --git a/cli/cli.ts b/cli/cli.ts index d06f13c84c5..ccc7d0987d6 100644 --- a/cli/cli.ts +++ b/cli/cli.ts @@ -22,5 +22,6 @@ if (command.help || (process.argv.length <= 2 && process.stdin.isTTY)) { // do nothing } - run(command); + // eslint-disable-next-line unicorn/no-process-exit + run(command).then(() => process.exit(0)); } diff --git a/cli/run/index.ts b/cli/run/index.ts index 6f0da69a708..24c382430b7 100644 --- a/cli/run/index.ts +++ b/cli/run/index.ts @@ -55,7 +55,7 @@ export default async function runRollup(command: Record): Promise): Promise { if (watcher) await watcher.close(); if (configWatcher) configWatcher.close(); - if (code) { - // eslint-disable-next-line unicorn/no-process-exit - process.exit(code); - } + // eslint-disable-next-line unicorn/no-process-exit + process.exit(code || 0); } + + // return a promise that never resolves to keep the process running + return new Promise(() => {}); } diff --git a/rollup.config.ts b/rollup.config.ts index 76c37cac3da..9c3d9c71e08 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,4 +1,3 @@ -import { exit } from 'node:process'; import { fileURLToPath } from 'node:url'; import alias from '@rollup/plugin-alias'; import commonjs from '@rollup/plugin-commonjs'; @@ -138,16 +137,7 @@ export default async function ( terser({ module: true, output: { comments: 'some' } }), collectLicensesBrowser(), writeLicenseBrowser(), - cleanBeforeWrite('browser/dist'), - { - closeBundle() { - // On CI, MacOS runs sometimes do not close properly. This is a hack - // to fix this until the problem is understood. - console.log('Force quit.'); - setTimeout(() => exit(0)); - }, - name: 'force-close' - } + cleanBeforeWrite('browser/dist') ], strictDeprecations: true, treeshake