Skip to content

Commit 3771447

Browse files
authored
package.json: list type exports for import. (#3915)
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 3771447

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
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",
12+
"import": {
13+
"default": "./priv/static/phoenix_live_view.esm.js",
14+
"types": "./assets/js/types/index.d.ts"
15+
},
1316
"require": "./priv/static/phoenix_live_view.cjs.js"
1417
},
1518
"author": "Chris McCord <chris@chrismccord.com> (http://www.phoenixframework.org)",

0 commit comments

Comments
 (0)