Firebase hosting redirects to function app, then function handles basic authentication, and then function sends back SPA.
npx create-react-app my-app --template typescript
cd myapp && firebase init
(hosting and functions)- write your code
- Build react by
npm run build
mv build functions/build
(functions can't access its parent directory so move build directory under functions/)mkdir dummy
(firebase hosting requires directory at hosting.public in firebase.json)firebase deploy
Now your directoory structure looks like
firebase.json
src/App.tsx
dummy/
functions/src/index.ts
funnctions/built/*