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, andtestscripts - and update your npm
startscript tonode build/bundle.js - Run command
nowinside./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
./distinside your./functions/and rename it to./functions/crau-dist - Update your rewrite on
firebase.json{ "source": "**", "function": "app" } - Update your
crau.config.jsmodule.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.jsconst 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
