Version/Environment (if relevant):
Applies to creating a React app in a Domino Workspace and deploying it as a Domino App. This example uses Create React App, though an existing React app can also be uploaded directly to a project instead.Resolution:
Create the app structure
If you’re using a Domino Standard Environment on Domino 5.9.x, Node.js and npm may already be included. If not present in your environment, add your preferred version by following the Node.js installation instructions (using nvm or fnm is recommended for Linux). Once Node.js and npm are available, open a Terminal in your Domino Workspace and run the following, substituting your own app name fordomino-react:
npx create-react-app domino-react
create-react-app package — confirm to proceed. Once installed, it will create your React app. On success, you’ll see output similar to:
/mnt folder:
Starting the app
Once the React app’s folder/file structure has synced from your Workspace to your project, add anapp.sh to start the app. App URLs are dynamic — they include the run ID — so the app’s homepage field in package.json must be set at runtime. The sample app.sh below does this, assuming a React app named domino-react:
homepage line to package.json if one doesn’t already exist, or overwrites the existing line with the current run’s app URL.
With this app.sh in place, publish your App. It will take a few minutes to prepare; once ready, you can view it:
Managing the app’s resources
Creating the app withcreate-react-app generates a large number of subfolders and files in node_modules. These are required for the app to run, but you may want to exclude them from syncing on future runs or Workspace startups. Add this folder to your .dominoignore file to do so:
Notes/Information:
Thesed -i "4i ..." fallback in app.sh assumes the homepage line should be inserted at line 4 of package.json. This works for the default file layout produced by Create React App, but if your package.json has a different structure, adjust the line number accordingly.