Create a local build of a standalone component, or all standalone components in a project, to validate component configuration, and to check for coding errors.

Use the following commands to build standalone components:
npm run buildComponent (builds a specific standalone component)
npm run buildAllComponents (builds all standalone components in the source folder)

The build command validates the component schema, performs linting, and bundles the component. These actions are also performed when publishing a component; however, build the component locally to ensure that it compiles without errors before publishing it to the server.

NOTE:
  • If changes made to the config.json file are not validated, the validation of the component schema could fail during the building and publishing process. To prevent this, ensure that you validate any changes made to the config.json file. For detailed information on the structure and attributes of the config.json file, see Component definition.
  • You might see warnings when linting is being performed. This will not prevent the process of publishing a component.

  1. Open a terminal at the DX component directory and run the following command:
    npm run buildComponent
  2. Select the standalone component to be built.
  3. Specify whether to generate a development build.
    A development build should be generated only during component development as it enables run-time debugging in the browser. Do not select a development build for deploying to production as the development build does not compress and obfuscate the component code .

    The command line interface depicting the details to be entered for building a Constellation DX component through the buildComponent command

    Command line interface - buildComponent

Result:

The Constellation DX Component Builder compiles the standalone component and creates a local build.
NOTE: Building all standalone components (npm run buildAllComponents) automatically executes the npm run buildComponent command for all standalone components in your source folder. You can find the bundled standalone components in the dist directory of your project's root folder.