From 56dafb32b14af0057215bce6aaad7d84b16fa049 Mon Sep 17 00:00:00 2001 From: Aleksei Terin Date: Wed, 5 Feb 2025 11:04:03 +0200 Subject: [PATCH 1/2] change typescript module resolution to resolve typescript resolution errors on build (#493) --- config/typescript/tsconfig.json | 2 +- config/typescript/tsconfig.node.json | 2 +- src/components/ReactP5WrapperGuard.tsx | 6 ++++-- src/components/ReactP5WrapperWithSketch.tsx | 6 ++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config/typescript/tsconfig.json b/config/typescript/tsconfig.json index 0068ff6..8d886db 100644 --- a/config/typescript/tsconfig.json +++ b/config/typescript/tsconfig.json @@ -12,7 +12,7 @@ "strict": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", - "moduleResolution": "bundler", + "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": false, diff --git a/config/typescript/tsconfig.node.json b/config/typescript/tsconfig.node.json index d59f735..c2f8e2c 100644 --- a/config/typescript/tsconfig.node.json +++ b/config/typescript/tsconfig.node.json @@ -2,7 +2,7 @@ "compilerOptions": { "composite": true, "module": "ESNext", - "moduleResolution": "bundler", + "moduleResolution": "node", "allowSyntheticDefaultImports": true }, "include": ["../vite/vite.component.config.ts"] diff --git a/src/components/ReactP5WrapperGuard.tsx b/src/components/ReactP5WrapperGuard.tsx index b74a8f3..c8000c8 100644 --- a/src/components/ReactP5WrapperGuard.tsx +++ b/src/components/ReactP5WrapperGuard.tsx @@ -17,9 +17,9 @@ const ErrorBoundary = React.lazy(() => })) ); -export default function ReactP5WrapperGuard( +const ReactP5WrapperGuard = ( props: P5WrapperProps -) { +) => { if (props.sketch === undefined) { console.error("[ReactP5Wrapper] The `sketch` prop is required."); @@ -52,3 +52,5 @@ export default function ReactP5WrapperGuard( ); } + +export default ReactP5WrapperGuard; \ No newline at end of file diff --git a/src/components/ReactP5WrapperWithSketch.tsx b/src/components/ReactP5WrapperWithSketch.tsx index 5a1e49f..d3c751d 100644 --- a/src/components/ReactP5WrapperWithSketch.tsx +++ b/src/components/ReactP5WrapperWithSketch.tsx @@ -9,9 +9,9 @@ import { removeCanvasInstance } from "../utils/removeCanvasInstance"; import { updateCanvasInstance } from "../utils/updateCanvasInstance"; import { withoutKeys } from "../utils/withoutKeys"; -export default function ReactP5WrapperWithSketch( +const ReactP5WrapperWithSketch = ( props: P5WrapperPropsWithSketch -) { +) => { const wrapperRef: WrapperRef = React.useRef(null); const canvasInstanceRef: CanvasInstanceRef = React.useRef(null); const userProvidedProps: SketchProps = React.useMemo( @@ -49,3 +49,5 @@ export default function ReactP5WrapperWithSketch( ); } + +export default ReactP5WrapperWithSketch; From a1006930e1ff76543d694232360c9d87162213dc Mon Sep 17 00:00:00 2001 From: Aleksei Terin Date: Wed, 5 Feb 2025 11:49:53 +0200 Subject: [PATCH 2/2] remove composite to prevent jsxRuntime externalize issues --- config/typescript/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/config/typescript/tsconfig.json b/config/typescript/tsconfig.json index 8d886db..e6f0f54 100644 --- a/config/typescript/tsconfig.json +++ b/config/typescript/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "target": "ESNext", - "composite": true, "useDefineForClassFields": true, "types": ["vite/client"], "lib": ["DOM", "DOM.Iterable", "ESNext"],