How to create React Production Build of OpenSearch Dashboard

Versions: 2.13.0 OpenSearch Dashboard

Describe the issue:
I have created a new plugin on top of the Opensearch Dashboard code. I’m intending to create a production build of the whole application. For any React application created using Create React App, we run the npm run build command. On looking at the OpenSearch Dashboard codebase, I found that the package.json contains custom scripts for build and almost everything. I also checked the Developer Guide readme present in OpenSearch Dashboard Github Repository. And I found a section named Building artifacts over there. Reference: OpenSearch-Dashboards/DEVELOPER_GUIDE.md at main · opensearch-project/OpenSearch-Dashboards · GitHub

It suggest running yarn build command. I tried running the command, but I’m getting self signed certificate error that too in the axios npm module. I’m wondering how to tackle this error or if there is any alternative way to create a React production build then please let me know. I would be thankful.

Configuration:
NA

Relevant Logs or Screenshots:

PS: @moderators

When I ran the command yarn build --skip-os-packages on my local system (MacBook Pro), I encountered errors. To troubleshoot, I decided to try running the command on a Linux machine. I cloned my code onto a Linux VM and executed yarn build-platform --linux, which worked successfully.

For any Mac users/anyone else out there facing this issue, I recommend setting up the codebase on a Linux VM and running the build command there. This solution worked for me, and it should hopefully resolve the issue for you as well.

Next you need to build the plugin as a .zip file and then install it to your OpenSearch Dashboard distribution

You can follow the steps below for it:

cd plugins/yourplugin

# This command will ask you for OS Dashboard version you are using or tying to install your plugin with
yarn build

cd ../..
cd build/opensearch-dashboards-{OS Dashboard version}-SNAPSHOT-linux-x64
./bin/opensearch-dashboards-plugin install file://{/path/to/your/plugin.zip}
1 Like