#10260·parcel

A target of `module` with `includeNodeModules` has incorrect import aliases

Author: psanchezeverhealthCreated Jan 21, 2026Updated Sep 16, 2026
LabelsStale

bug report

When doing a basic node library to write a GitHub Action and using includeNodeModules and a module target, certain import aliases are inconsistently referenced in the output resulting in a runtime error. Using a main target does however work. The application has a dependency on @actions/core.

Configuration (.babelrc, package.json, cli command)

package.json

json
{
    "name": "parcel_error_sample",
    "version": "1.0.0",
    "type": "module",
    "source": "./src/main.js",
    "module": "./dist/module.js",
    "main": "./dist/main.cjs",
    "exports": {
        "import": "./dist/module.js",
        "require": "./dist/main.cjs"
    },
    "scripts": {
        "build": "parcel build"
    },
    "dependencies": {
        "@actions/core": "^2.0.2"
    },
    "devDependencies": {
        "parcel": "^2.16.3"
    },
    "engines": {
        "node": ">=24"
    },
    "targets": {
        "module": {
            "includeNodeModules": true
        },
        "main": {
            "includeNodeModules": true
        }
    }
}

Expected Behavior

Running node dist/main.cjs and node dist/module.js runs without error.

Current Behavior

Running node dist/module.js crashes with an error.

file:///opt/app/.github/actions/git_diff/dist/module.js:208
$5DWW0$inherits($4c21e8ebd1913d6e$var$TunnelingAgent, $5DWW0$EventEmitter);
^

ReferenceError: $5DWW0$inherits is not defined
    at Object.<anonymous> (file:///opt/app/.github/actions/git_diff/dist/module.js:208:1)
    at parcelRequire (file:///opt/app/.github/actions/git_diff/dist/module.js:53:12)
    at Object.<anonymous> (file:///opt/app/.github/actions/git_diff/dist/module.js:134:19)
    at parcelRequire (file:///opt/app/.github/actions/git_diff/dist/module.js:53:12)
    at file:///opt/app/.github/actions/git_diff/dist/module.js:19136:74
    at ModuleJob.run (node:internal/modules/esm/module_job:413:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:660:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)

Node.js v24.12.0

Possible Solution

When looking at the built output, it looks like a couple imports from node:util and node:events are aliased to something like:

javascript
import {inherits as $5DWW0$inherits1} from "node:util";
import {EventEmitter as $5DWW0$EventEmitter1} from "node:events";

However at certain points within the file, it will correctly use the named alias, and sometimes reference it without the 1 suffix.

javascript
// ERRORS
$5DWW0$inherits($4c21e8ebd1913d6e$var$TunnelingAgent, $5DWW0$EventEmitter);

// Correct
var $3b155cd00fdc2829$require$inherits = $5DWW0$inherits1;

Context

Compile a simple node application for GitHub Actions and for AWS Lambda. The runtime is node 24, so using native es modules is desirable.

Code Sample

src/main.js

javascript
import * as core from "@actions/core";

export function main() {
    console.log(core);
}

main();

Your Environment

Software Version(s)
Parcel 2.16.3
Node 24.12.0
npm/Yarn 11.6.2
Operating System Debian 12 (bookworm)