React Data Grid Custom builds

Create your own build of Handsontable, using the available npm tasks.

About building

Get an overview of Handsontable's building processes.

Monorepo

The Handsontable repository is a monorepo that contains the following projects:

Project Location Description
handsontable /handsontable Main Handsontable project
@handsontable/react /wrappers/react React wrapper
@handsontable/angular /wrappers/angular Angular wrapper
@handsontable/vue /wrappers/vue Vue 2 wrapper
@handsontable/vue3 /wrappers/vue3 Vue 3 wrapper

All the projects are released together, under the same version number. But each project has its own building and testing processes.

Building processes

The building processes transform the source files located in the /handsontable/src/ directory into the following output files:

  • /handsontable/dist/handsontable.js
  • /handsontable/dist/handsontable.css
  • /handsontable/dist/handsontable.full.js
  • /handsontable/dist/handsontable.full.css
  • /handsontable/dist/handsontable.full.min.js
  • /handsontable/dist/handsontable.full.min.css
  • /handsontable/dist/languages/*

TIP

Don't modify the output files mentioned above. Instead, make changes in the /handsontable/src/ directory and then run a selected build. This is especially important if you want to contribute your changes back to Handsontable through a pull request.

For more information on the distribution packages, see this file (opens new window).

Building requirements

Handsontable building processes require:

package.json files

Each Handsontable project has its own building processes defined in its own package.json file. Apart from that, the root directory has its own package.json file as well:

File Holds tasks for building:
/package.json - All the packages at once
- Individual packages
/handsontable/package.json The JavaScript package
/wrappers/react/package.json The React package
/wrappers/angular/package.json The Angular package
/wrappers/vue/package.json The Vue 2 package
/wrappers/vue3/package.json The Vue 3 package

Running your first build

To run your first build:

  1. Install Node.js (opens new window) (version 16.17+).
  2. Install npm (opens new window) (version 8.15+).
  3. Clone the Handsontable repository (opens new window).
  4. From the root directory, run npm install.
    All the required dependencies get installed.
  5. From the root directory, run npm run build.
    All the Handsontable packages get built.

Building the packages

You can either build all the packages at once, or build each package individually.

Building all the packages

To build all the packages at once:

  1. Make sure you meet the building requirements.
  2. Go to the root directory.
  3. Run npm run build.
    The script builds the following packages:
    • The JavaScript package
    • The React package
    • The Angular package
    • The Vue 2 package
    • The Vue 3 package
    • A code examples package

Building the JavaScript package

To build the JavaScript package:

  1. Make sure you meet the building requirements.
  2. Go to /handsontable.
  3. Run npm run build.
    Only the JavaScript package builds.

To build the JavaScript package from the root directory:

  1. Make sure you meet the building requirements.
  2. Go to the root directory.
  3. Run npm run in handsontable build.
    Only the JavaScript package builds.

JavaScript build tasks

From the /handsontable directory, you can also run individual JavaScript build tasks:

JavaScript build tasks

npm run build:commonjs

  • Transpiles the files into the CommonJS format.

npm run build:es

  • Transpiles the files into the ESM format.

npm run build:umd

  • Creates the following bundles compatible with the Universal Module Definition:
    • /handsontable/dist/handsontable.js
    • /handsontable/dist/handsontable.css
    • /handsontable/dist/handsontable.full.js
    • /handsontable/dist/handsontable.full.css

npm run build:umd.min

  • Creates the minified bundles compatible with the Universal Module Definition:
    • /handsontable/dist/handsontable.min.js
    • /handsontable/dist/handsontable.min.css
    • /handsontable/dist/handsontable.min.full.js
    • /handsontable/dist/handsontable.min.full.css

npm run build:walkontable

  • Builds Walkontable, an essential part of Handsontable that's responsible for the rendering process.

npm run build:languages

  • Creates the language bundles compatible with the Universal Module Definition, for example:
    • /handsontable/dist/languages/de-DE.js
    • /handsontable/dist/languages/all.js

build:languages.es

  • Creates the language bundles compatible with the ESM format, for example:
    • languages/en-US.mjs

npm run build:languages.min

  • Creates the minified language bundles compatible with the Universal Module Definition, for example:
    • /handsontable/dist/languages/de-DE.min.js
    • /handsontable/dist/languages/all.min.js

Building the React package

To build the React package:

  1. Make sure you meet the building requirements.
  2. Go to /wrappers/react.
  3. Run npm run build.
    Only the React package builds.

To build the React package from the root directory:

  1. Make sure you meet the building requirements.
  2. Go to the root directory.
  3. Run npm run in react build.
    Only the React package builds.

React build tasks

From the /wrappers/react directory, you can also run individual React build tasks:

React build tasks

npm run build:commonjs

  • Transpiles the files into the CommonJS format.
  • Places the output in /wrappers/react/commonjs/react-handsontable.js

npm run build:umd

  • Creates the following bundles compatible with the Universal Module Definition:
    • /wrappers/react/dist/react-handsontable.js
    • /wrappers/react/dist/react-handsontable.js.map

npm run build:es

  • Transpiles the files into the ESM format.
  • Places the output in /wrappers/react/es/react-handsontable.js

npm run build:min

  • Creates the minified bundles:
    • /wrappers/react/dist/react-handsontable.min.js
    • /wrappers/react/dist/react-handsontable.min.js.map

  • Testing