Skip to content

Commit 8e869e0

Browse files
wight554JoviDeCroock
authored andcommitted
add named export to improve "module": "nodenext" compatibility (preactjs#48)
* add named export to improve `"module": "nodenext"` compatibility * add proper types export * Update src/index.ts Co-authored-by: Jovi De Croock <[email protected]> Co-authored-by: Jovi De Croock <[email protected]>
1 parent 767e93f commit 8e869e0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"exports": {
88
".": {
99
"import": "./dist/esm/index.mjs",
10-
"require": "./dist/cjs/index.js"
10+
"require": "./dist/cjs/index.js",
11+
"types": "./dist/types/index.d.ts"
1112
},
1213
"./package.json": "./package.json"
1314
},

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export interface PreactBabelOptions extends BabelOptions {
5454
}
5555

5656
// Taken from https://github.com/vitejs/vite/blob/main/packages/plugin-react/src/index.ts
57-
export default function preactPlugin({
57+
function preactPlugin({
5858
devtoolsInProd,
5959
include,
6060
exclude,
@@ -173,3 +173,6 @@ export default function preactPlugin({
173173
prefresh({ include, exclude }),
174174
];
175175
}
176+
177+
export default preactPlugin;
178+
export { preactPlugin as preact };

0 commit comments

Comments
 (0)