Skip to content

Commit

Permalink
allow jsx import source to be configured
Browse files Browse the repository at this point in the history
  • Loading branch information
Interpause committed Apr 14, 2022
1 parent 095c735 commit 2d6d079
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export interface PreactPluginOptions {
* Babel configuration applied in both dev and prod.
*/
babel?: BabelOptions;
/**
* Import Source for jsx. Defaults to "preact".
*/
jsxImportSource?: string;
}

export interface PreactBabelOptions extends BabelOptions {
Expand All @@ -56,6 +60,7 @@ export default function preactPlugin({
include,
exclude,
babel,
jsxImportSource,
}: PreactPluginOptions = {}): Plugin[] {
let config: ResolvedConfig;

Expand Down Expand Up @@ -149,7 +154,7 @@ export default function preactPlugin({
: "@babel/plugin-transform-react-jsx-development",
{
runtime: "automatic",
importSource: "preact",
importSource: jsxImportSource ?? "preact",
},
],
...(config.isProduction ? [] : ["babel-plugin-transform-hook-names"]),
Expand Down

0 comments on commit 2d6d079

Please sign in to comment.