Skip to content

Commit 8223769

Browse files
Interpausesapphi-redJoviDeCroockwight554
authored
Allow JSX Import Source to be overwritten (#47)
* allow jsx import source to be configured * allow package to be installed via git * fix: support vite v3 (#50) * 2.3.0 (#53) * add named export to improve `"module": "nodenext"` compatibility (#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]> * Update package.json * remove "prepare" script --------- Co-authored-by: 翠 / green <[email protected]> Co-authored-by: Jovi De Croock <[email protected]> Co-authored-by: Volodymyr Zhdanov <[email protected]>
1 parent 80cb54e commit 8223769

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export interface PreactPluginOptions {
5757
* Babel configuration applied in both dev and prod.
5858
*/
5959
babel?: BabelOptions;
60+
/**
61+
* Import Source for jsx. Defaults to "preact".
62+
*/
63+
jsxImportSource?: string;
6064
}
6165

6266
export interface PreactBabelOptions extends BabelOptions {
@@ -77,6 +81,7 @@ function preactPlugin({
7781
include,
7882
exclude,
7983
babel,
84+
jsxImportSource,
8085
}: PreactPluginOptions = {}): Plugin[] {
8186
const baseParserOptions = [
8287
"importMeta",
@@ -157,7 +162,7 @@ function preactPlugin({
157162
: "@babel/plugin-transform-react-jsx-development",
158163
{
159164
runtime: "automatic",
160-
importSource: "preact",
165+
importSource: jsxImportSource ?? "preact",
161166
},
162167
],
163168
...(config.isProduction ? [] : ["babel-plugin-transform-hook-names"]),

0 commit comments

Comments
 (0)