Skip to content

Commit 90eaba1

Browse files
committed
Improve Node.js/browser environment detection and dependency handling
- Updated shims.js to properly detect Node.js vs browser environments - Only attempt to require Node.js modules (ws/jsdom) when actually in Node.js - Added clearer error messages explaining required packages - Moved jsdom and ws from optionalDependencies to peerDependencies - Updated README.md to document Node.js requirements - Added peerDependenciesMeta to mark Node.js deps as optional - Improved error messages to be more specific about environment requirements
1 parent ec0a08c commit 90eaba1

6 files changed

Lines changed: 134 additions & 82 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ doc
1616
doc-tmp
1717
tags.lock
1818
tags.temp
19+
.aider*

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ Mobile Safari, Chrome, Chrome for Android, Opera and the mobile Opera browser.
2626

2727
Since version 1.3.0, support for IE < 11 has been dropped.
2828

29+
### Node.js
30+
31+
When running in Node.js, you'll need to install these additional packages:
32+
33+
```bash
34+
npm install jsdom ws
35+
```
36+
37+
These provide the required WebSocket and DOM APIs that are normally available in browsers.
38+
2939
### React Native
3040

3141
Since version 1.6.0 the [WebCrypto](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)

0 commit comments

Comments
 (0)