Skip to content

Commit 7659746

Browse files
committed
package.json: list type exports.
Without something like this, we get the following when using moduleResolution "bundler": ``` js/app.ts:3:34 - error TS7016: Could not find a declaration file for module 'phoenix_live_view'. '[...]/node_modules/phoenix_live_view/priv/static/phoenix_live_view.esm.js' implicitly has an 'any' type. There are types at '[...]/node_modules/phoenix_live_view/assets/js/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'phoenix_live_view' library may need to update its package.json or typings. 3 import { Hook, LiveSocket } from "phoenix_live_view" ~~~~~~~~~~~~~~~~~~~ ```
1 parent 8503c96 commit 7659746

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@
99
"unpkg": "./priv/static/phoenix_live_view.min.js",
1010
"jsdelivr": "./priv/static/phoenix_live_view.min.js",
1111
"exports": {
12-
"import": "./priv/static/phoenix_live_view.esm.js",
13-
"require": "./priv/static/phoenix_live_view.cjs.js"
12+
"import": {
13+
"default": "./priv/static/phoenix_live_view.esm.js",
14+
"types": "./assets/js/types/index.d.ts"
15+
},
16+
"require": {
17+
"default": "./priv/static/phoenix_live_view.cjs.js",
18+
"types": "./assets/js/types/index.d.ts"
19+
}
1420
},
1521
"author": "Chris McCord <chris@chrismccord.com> (http://www.phoenixframework.org)",
1622
"repository": {

0 commit comments

Comments
 (0)