Skip to content

Babel 8 support: @babel/register deadlocks with stdin program entry #162

Description

@laat

Problem

Bumping the babel-register / flow-type examples to Babel 8 hangs readme-assert forever (dependabot PRs #159 and #160 hung CI for the full 6-hour timeout; #161 reverted the bump).

readme-assert pipes each code unit to a child node process via stdin with an explicit --input-type flag (src/run.ts). With @babel/register 8 preloaded, that child deadlocks before executing anything.

Minimal repro

npm i @babel/core@8 @babel/register@8
echo "console.log('x')" | node --input-type=commonjs --require @babel/register -
# hangs forever; with Babel 7 it prints "x" and exits

What's known

  • Affects @babel/register 8.0.0 and 8.0.1 (both tested in a clean project).
  • The trigger is --input-type (either value) + program on stdin. Without --input-type, stdin entry works. -e and file entries work.
  • The preload mechanism doesn't matter: --require and --import both deadlock identically.
  • Babel 8 moved the register transform to a worker thread with blocking sync messaging ([babel 8] Move @babel/register transform to a separate worker babel/babel#14025). --input-type routes the stdin entry through the ESM loader, and that path deadlocks against the hook worker.
  • Not yet reported upstream on babel/babel (searched issues + web, 2026-07).

Options

  1. Report upstream to babel/babel and wait for a fix (examples stay on Babel 7; dependabot ignore rules for @babel/* majors are in place since Bump the all-dependencies group across 1 directory with 13 updates #161).
  2. Switch readme-assert from stdin to temp-file execution: write each unit to a scratch file whose extension carries the type (.mjs/.cjs/.mts/.cts) instead of using --input-type. Sidesteps the bug entirely, but touches the [stdin] path rewriting and sourcemap handling in run.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions