Commit b27526b6 authored by James Hegedus's avatar James Hegedus Committed by Tim Neutkens

with-firebase-hosting update (#2683)

* Fix link in with-firebase-hosting example

* with-firebase-hosting example

Update npm scripts & README
parent c87b471b
...@@ -21,9 +21,7 @@ Set up firebase: ...@@ -21,9 +21,7 @@ Set up firebase:
Install project: Install project:
```bash Each of the other commands pre-installs all dependencies
npm install
```
Run Next.js development: Run Next.js development:
...@@ -46,10 +44,10 @@ npm run deploy ...@@ -46,10 +44,10 @@ npm run deploy
## The idea behind the example ## The idea behind the example
The goal is to host the Next.js app on Firebase Cloud Functions with Firebase Hosting rewrite rules so our app is served from our Firebase Hosting URL. Each individual `page` bundle is served in a new call to the Cloud Function which performs the initial server render. The goal is to host the Next.js app on Firebase Cloud Functions with Firebase Hosting rewrite rules so our app is served from our Firebase Hosting URL. Each individual `page` bundle is served in a new call to the Cloud Function which performs the initial server render.
This is based off of the work at https://github.com/geovanisouza92/serverless-firebase & https://github.com/jthegedus/firebase-functions-next-example as described [here](https://medium.com/jthegedus/) This is based off of the work at https://github.com/geovanisouza92/serverless-firebase & https://github.com/jthegedus/firebase-functions-next-example as described [here](https://medium.com/@jthegedus/next-js-on-cloud-functions-for-firebase-with-firebase-hosting-7911465298f2).
## Important & Caveats ## Important & Caveats
* The empty `placeholder.html` file is so Firebase Hosting does not error on an empty `public/` folder and still hosts at the Firebase project URL. * The empty `placeholder.html` file is so Firebase Hosting does not error on an empty `public/` folder and still hosts at the Firebase project URL.
* `firebase.json` outlines the catchall rewrite rule for our Cloud Function. * `firebase.json` outlines the catchall rewrite rule for our Cloud Function.
* Testing on Firebase locally requires a complete build of the Next.js app. `npm run serve` handles everything required. * Testing on Firebase locally requires a complete build of the Next.js app. `npm run serve` handles everything required.
* Any npm modules dependencies used in the Next.js app (`app/` folder) must also be installed as dependencies for the Cloud Functions project (`functions` folder). * **Any npm modules dependencies used in the Next.js app (`app/` folder) must also be installed as dependencies for the Cloud Functions project (`functions` folder).**
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
"version": "1.0.0", "version": "1.0.0",
"description": "Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.", "description": "Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.",
"scripts": { "scripts": {
"install": "npm run build-all",
"next": "npm run build-firebase && cd \"app\" && npm i && npm run dev", "next": "npm run build-firebase && cd \"app\" && npm i && npm run dev",
"preserve": "npm run build-all", "preserve": "npm run build-all",
"serve": "firebase serve", "serve": "firebase serve",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment