Publish a react app through Domino

vaibhav.dhawanvaibhav.dhawan Member, Administrator, Moderator, Domino Posts: 4 admin
edited August 27 in How-To Guides

This example uses the "Create React App" package:

The objective here is to make sure the app knows the base domain/subdirectory so that resources are referenced correctly. Application domains are dynamic since they include the run ID, so this must be set at runtime. Here is a sample app.sh file that will accomplish this, assuming you have already run create react app to create a new project called 'testing' in your project:

# Modify base url for your deployment (domain.domino.tech), user (test_user), project (react_app)
URL_BASE="https://domain.domino.tech/test_user/react_app/r/notebookSession/"

# change to point to directory with create-react-app project
cd $DOMINO_WORKING_DIR
cd testing

# Set hostname to the base url for the app in package.json
sed "4i  \"homepage\": \"$URL_BASE$DOMINO_RUN_ID\"," package.json -i

npm run build

serve -s build -l 8888

Note that you will need a compute environment with the correct packages (npm/yarn , create react, serve) installed in order to support this

Tagged:

Comments

Sign In or Register to comment.