Deployment
Here are some deployment services you can try:
These tutorials assumed that you've built your app using
cra-universal build
Now by Zeit
- Edit
package.json
, removebuild
, andtest
scripts - and update your npm
start
script tonode build/bundle.js
- Run command
now
inside./dist
- Optional: you might need to remove your sourcemaps for free plan
Firebase Functions by Google
I also published the full article on Medium, check it out here
- Copy
./dist
inside your./functions/
and rename it to./functions/crau-dist
- Update your rewrite on
firebase.json
{ "source": "**", "function": "app" }
- Update your
crau.config.js
module.exports = { modifyWebpack: config => { const newConfig = { ...config, output: { ...config.output, libraryTarget: 'commonjs2' }, entry: env ? './server/index.js' : './server/app.js' }; return newConfig; } };
- Update your
./functions/index.js
const functions = require('firebase-functions'); const app = require('./crau-dist/server/bundle'); exports.app = functions.https.onRequest(app);
- Add your server dependencies into your function
package.json
- Remove
./build/index.html
(let firebase function serve it) - Deploy using Firebase CLI
firebase deploy