-
-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Environment
- expect-webdriverio version: 5.5.0+ (tested with 5.6.2)
- WebDriverIO version: 9.23.2
- Node.js version: 22
- OS: macOS / Linux (CodeBuild)
Description
Starting from version 5.5.0, expect-webdriverio has a packaging issue where the exports field in package.json points to a non-existent file.
** Expected behavior**
The exports field should point to the actual entry point file.
** Actual behavior**
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/expect-webdriverio/lib/index.js'
imported from .../node_modules/@wdio/runner/build/index.js
Root Cause
In package.json, the exports field declares:
"exports": {
".": [
{
"types": "./types/expect-webdriverio.d.ts",
"import": "./lib/index.js"
},
"./lib/index.js"
]
}
But the actual file structure is:
lib/
├── src/
│ ├── index.js ← Actual file location
│ ├── matchers.js
│ └── ...
└── tsconfig.build.tsbuildinfo
The entry point is at ./lib/src/index.js, not ./lib/index.js.
**Steps to Reproduce**
Create a new WebDriverIO project with ESM ("type": "module")
Install [email protected] and @wdio/[email protected]
Run any WebDriverIO test
Error occurs immediately
**Workaround**
Pinning to version 5.3.4 works correctly:
**Suggested Fix**
Either:
Update exports to point to ./lib/src/index.js, or
Adjust the build configuration to output the entry point at ./lib/index.js
Affected Versions
✅ v5.3.4 - Works correctly (lib/index.js exists)
❌ v5.5.0+ - Broken (lib/index.js missing, file is at lib/src/index.js)Metadata
Metadata
Assignees
Labels
No labels