#Add button to existing element on the website
25 messages · Page 1 of 1 (latest)
"content_scripts":
[
{
"matches":["*://*.example.com/*"],
"js":["./src/ContactButton.tsx"]
}
],
but when I try to actually add my extension to the browser
it says that it cant find "ContactButton.tsx"
@fiery horizon Browsers do not run tsx files: they don't understand either JSX syntax or TS syntax.
You'll need to generate a JS file somehow - common to use some sort of bundling/build tool like rollup or vite.
im using vite
Then you'd need to point the manifest at a built js file that comes out of vite.
okay but how can i know where the built js will be?
That's vite configuration. dist is probably the usual place it'd end up.
well its not here
Well, ContactButton is probably not configured as an entry point for your project in Vite.
Well, the extension is going to need some sort of entry point to work with.
You can't just point it at a React component
i think the App.tsx is the entry point
or main.tsx
i want the ContactButton to be a separate thing from my main extension that will run only on a specific website
the rest of the extension runs in its popup