Skip to content

Commit

Permalink
Allow JSX Import Source to be overwritten (#47)
Browse files Browse the repository at this point in the history
* 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 <decroockjovi@gmail.com>

Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>

* Update package.json

* remove "prepare" script

---------

Co-authored-by: 翠 / green <green@sapphi.red>
Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
Co-authored-by: Volodymyr Zhdanov <wight554@gmail.com>
  • Loading branch information
4 people committed Oct 13, 2023
1 parent 80cb54e commit 8223769
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.ts
Expand Up @@ -57,6 +57,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 @@ -77,6 +81,7 @@ function preactPlugin({
include,
exclude,
babel,
jsxImportSource,
}: PreactPluginOptions = {}): Plugin[] {
const baseParserOptions = [
"importMeta",
Expand Down Expand Up @@ -157,7 +162,7 @@ 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 8223769

Please sign in to comment.