Digital-Alchemy-TS / Digital-Alchemy-TS/core

package.json ./testing subpath export points to non-existent path — ERR_MODULE_NOT_FOUND

Open Beginner friendly
#342 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
53
Forks
1
Avg merge
1m
Merged PRs (30d)
1

Description

## Summary

`import { TestRunner } from "@digital-alchemy/core/testing"` throws `ERR_MODULE_NOT_FOUND` under Node.js ESM. The `exports` map in `package.json` targets a path that does not exist in the published `dist/`.

## Affected version

`@digital-alchemy/core` **26.6.21**
Runtime: node v24.17.0

## Symptom

```
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
'.../@digital-alchemy/core/dist/testing/helpers/index.mjs'
imported from .mjs
```

Any test or consumer importing `TestRunner` (or `createMockLogger`) via the `@digital-alchemy/core/testing` subpath fails to load under Node's exports resolver.

## Root cause

`package.json` `exports` field contains a stale extra `helpers/` path segment:

```json
"./testing": "./dist/testing/helpers/index.mjs"
```

The mapped target `./dist/testing/helpers/index.mjs` **does not exist** — there is no `dist/testing/helpers/` directory in the published package.

The real barrel **does exist** at `./dist/testing/index.mjs` (re-exports `mock-logger` and `test-module`), with types alongside at `./dist/testing/index.d.mts`.

## Proposed fix (one line in package.json)

**Before:**

```json
"./testing": "./dist/testing/helpers/index.mjs"
```

**After:**

```json
"./testing": "./dist/testing/index.mjs"
```

The export target is a bare string, so this single correction resolves both the runtime `.mjs` and the TypeScript `moduleResolution: node16`/`bundler` types via the adjacent `./dist/testing/index.d.mts` — no conditional `import`/`types` object needed.

## Verification

After patching `exports`, a bare Node ESM import should resolve cleanly:

```sh
node --input-type=module -e \
'import("@digital-alchemy/core/testing").then(m => console.log(Object.keys(m)))'
# expected: [ 'createMockLogger', 'TestRunner' ]
```

Contributor guide

Open the contributing guide

Research direction

Start in package.json and inspect the ./testing export alongside the published dist/testing files, then run the provided Node.js ESM import command. Done means the subpath resolves without ERR_MODULE_NOT_FOUND and exposes createMockLogger and TestRunner.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
developer-experience
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
92/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.