cem-tools icon indicating copy to clipboard operation
cem-tools copied to clipboard

[custom-element-jsx-integration] Error cannot read properties of undefined (reading startsWith')

Open hasanirogers opened this issue 2 years ago • 0 comments

Hey there! Currently trying to use JSX Integration to generate types for my React 19+ Sandbox. Running into the following error:

Screenshot from 2024-11-17 16-15-24

Repo: https://github.com/hasanirogers/web-components-reactbox/tree/jsx

Any ideas on what I'm doing wrong? It seems to be reading my components from my custom-elements.json file as it logs their name. My build file looks like:

import { generateJsxTypes } from "custom-element-jsx-integration";
import { readFileSync } from 'fs';

const manifest = JSON.parse(readFileSync(new URL('./node_modules/kemet-ui/custom-elements.json', import.meta.url), 'utf8'));

const options = {
    defaultExport: true,
    componentTypePath: (name, tag) => {
       console.log(name);
       return `./node_modules/kemet-ui/dist/components/${tag}/${tag}.d.ts`; // what is this relative to? 
    }
};

generateJsxTypes(manifest, options);

hasanirogers avatar Nov 17 '24 21:11 hasanirogers