score:1
i found a solution but it was not using create-react-app
and webpack
. it looks like parcel supports multiple entry points out of the box without any configuration.
assuming a directory structure like this:
├── chrome
│ └── background.ts
├── html
│ ├── custom.html
│ ├── options.html
│ └── popup.html
├── manifest.json
├── package.json
├── react
│ ├── custom.tsx
│ ├── options.tsx
│ └── popup.tsx
with parcel.js you simply do:
parcel build html/*.html react/*.tsx chrome/*.ts
and it will handle the multiple entry points. i created a repository that contains a template for that approach, it contains a fully runnable example.
score:3
there is a custom cra template that exactly fits your needs: complex-browserext-typescript
.
usage:
npx create-react-app my-app --template complex-browserext-typescript
by default it sets up 4 entry points associated with page-like extension components:
- popup (
src/index.tsx
) - extension's popup page, replaces the default index entry point. - options (
src/options.tsx
) - extension's options page. - background (
src/background.ts
) - background script. - content (
src/content.ts
) - content script.
however there is an option to exclude any of the above components except the popup from compilation as well as add extra html page(s).
also see this article for usage example.
Source: stackoverflow.com
Related Query
- How to set up a chrome extension using React and TypeScript with multiple pages and entry points?
- How to set multiple values at once in react hook form using Typescript
- Understanding how to have multiple pages with React and react-router
- React and Material-UI: how to structure application with multiple pages
- How to call an API with multiple pages using react
- How to set up Babel 6 stage 0 with React and Webpack
- How do I store JWT and send them with every request using react
- How to use React with Typescript and SASS
- How to correctly set initial state in React with Typescript without constructor?
- How to use forwardRef with FunctionComponent in React Native using TypeScript
- How to set a test for multiple fetches with Promise.all using jest
- How to use jest.spyOn with React function component using Typescript
- How does react render multiple pages in app.js using react-router?
- Connecting a component with OwnProps using react redux and typescript in the .NET Core 2.0 reactredux template project
- How to set route with optional query parameter using React router?
- can i use the tsx extension for test files if using react with typescript
- how to change image src using props with styled component and react
- How to display multiple elements using bootstrap grid system and React Js
- How to inline multiple SVGs with React using Webpack?
- How to test with jest and typescript with types a basic react function component
- How to use emotion/styled with React and Typescript
- How to set active link in Navbar using Nav.Link and React Router?
- TypeScript parameter type is a union of multiple types: How can I determine which was supplied and work with it?
- How to set up Typescript with a React state with an Object?
- Remove Event Handler using Abort Signal with Typescript and React
- How to Upload files in graphql using graphene-file-upload with apollo-upload-client to Python Database and react front-end.?
- React Convert Div and Table Component Into PDF With Multiple Pages and CSS
- How do I correctly add data from multiple endpoints called inside useEffect to the state object using React Hooks and Context API?
- Using TypeScript with React HOC, React.lazy and forwarRef
- How can I validate an Autocomplete multiple TextField using React Hook Form and Yup?
More Query from same tag
- How to localstorage set users data (Problem with OPTIONS before post)
- React prop-types error
- Prevent page scrolling when mouse is over one particular div
- Render prop as string or component with Typescript
- How to use styled components in React in order to get keyframe animations
- React Hook. Cannot read property 'map' of nested list
- Polling API until task status is set to 'COMPLETELY_SIGNED' using React
- reactjs and rendering plain HTML
- Passing Variables Into Custom Button
- React App JS - How to reference static JSON File
- Failed to compile : React Hook "useState" cannot be called at the top level
- How to enable a component behavior inside disabled tab in material-ui?
- Can TypeScript make React component instantiation type safe?
- Meteor call method use the return value
- React-Bootstrap DropDown Button pullRight/Left
- Why my bottom sub-component is shown on top of a page?
- React Hook Warnings for async function in useEffect: useEffect function must return a cleanup function or nothing
- Handling view logic in redux
- Filter option in form select in React js
- ESLint TableRow is not defined - React in .NET Core project
- Examples of client side auth in react
- How to change lines in an react array?
- Trying to setup a filter by changing classNames based on what filter is selected, for some reason unable to remove the classname
- Reach child does not update when state changes
- Filter Inside UseEffect React Not Working
- Cannot destructure property 'currentUser' of 'Object(...)(...)' as it is null
- My Redux state has changed, why doesn't React trigger a re-render?
- Understanding JSX element declaration syntax
- How to use Material-UI Grid for SPA (negative margin problem)
- React Router changes URL but doesn't update the page unless it was refresh from browser