Skip to content

Commit

Permalink
fix: typescript transpilation by enabling tsx loader for jsxPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
adbayb committed Nov 22, 2021
1 parent 53357e8 commit 1e8f80d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions examples/ts-module/src/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export const Button = () => {
interface ButtonProps {
label: string;
}

export const Button = (props: ButtonProps) => {
return (
<>
<button>Click me!</button>Plop
<button>{props.label}</button> Plop
</>
);
};
2 changes: 1 addition & 1 deletion examples/ts-react/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";

interface AppProps {
label: string;
label?: string;
}

export const App = (props: AppProps) => {
Expand Down
2 changes: 1 addition & 1 deletion src/bundler/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const createBundler = async (

await build({
absWorkingDir: CWD,
// bundle: true, // @todo: fix (not working with typescript like syntax (type/interface))
bundle: Boolean(metadata.externalDependencies),
define: {
"process.env.NODE_ENV": isProduction
? '"production"'
Expand Down
2 changes: 1 addition & 1 deletion src/bundler/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const jsxPlugin = (

return {
contents: `import * as React from "${module}";${content}`,
loader: "jsx",
loader: "tsx",
};
});
},
Expand Down

0 comments on commit 1e8f80d

Please sign in to comment.