Skip to content

Commit

Permalink
Switch to using package.json exports for entrypoints
Browse files Browse the repository at this point in the history
This allows users to import the module-based version by writing

```
import { BaseRealtime } from 'ably/modules'
```

instead of having to import 'ably/build/modules'.

I followed the guidance in [1] and [2].

[1] https://nodejs.org/api/packages.html#exports
[2] https://webpack.js.org/guides/package-exports/
  • Loading branch information
lawrence-forooghian committed Nov 13, 2023
1 parent 0414b47 commit 94e44af
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
"url": "https://github.com/ably/ably-js/issues",
"email": "[email protected]"
},
"main": "./build/ably-node.js",
"typings": "./ably.d.ts",
"react-native": {
"./build/ably-node.js": "./build/ably-reactnative.js"
},
"browser": {
"./build/ably-node.js": "./build/ably.js"
"exports": {
".": {
"node": "./build/ably-node.js",
"react-native": "./build/ably-reactnative.js",
"default": "./build/ably.js"
},
"./modules": {
"default": "./build/modules/index.js"
}
},
"typings": "./ably.d.ts",
"files": [
"build/**",
"ably.d.ts",
Expand Down

0 comments on commit 94e44af

Please sign in to comment.