Need a special offer?Find out if your project fits.
All documentation
  • Introduction
  • Connecting to data source
  • Browser compatibility
  • Documentation for older versions
  • Integration with webpack

    This tutorial will help you integrate the pivot table with webpack. Follow these steps to set up a simple webpack project using Flexmonster Pivot Table & Charts:


    Step 1. Create a new project based on the sample from GitHub

    Download a .zip archive with the sample or clone it from GitHub with the following commands:

    git clone
    cd pivot-webpack

    Step 2. Install npm dependencies

    Install the npm dependencies described in package.json:

    npm install

    Step 3. Run the sample project

    Run in the console:

    npm start

    After that, the working sample will be available at http://localhost:8080/.

    Project structure

    Let’s take a closer look at the folder structure of this application:

    • dist/
      • index.html – here we add the <div> container for Flexmonster.
    • src/
      • index.js – here we embed our pivot table.
    • package.json – contains the description of the npm dependencies.
    • webpack.config.js – the webpack configuration file with standard CSS and font loading.

    Take a look at the content of the key files:


    // ES2015  
    import 'flexmonster/flexmonster.min.css';
    import Flexmonster from 'flexmonster';

    // CommonJS
    // require('flexmonster/flexmonster.min.css');
    // const Flexmonster = require('flexmonster');

    new Flexmonster({
    container: "#pivot",
    toolbar: true,
    report: {
    dataSource: {
    type: "json",
    filename: "",
    mapping: {
    // Mapping configuration
    slice: {
    // Slice configuration
    conditions: [
    // Conditional formatting
    formats: [
    // Number formatting


    const path = require('path');

    module.exports = {
    mode: 'development',
    entry: {
    app: './src/index.js',
    devServer: {
    static: './dist'
    output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
    module: {
    rules: [
    test: /\.css$/,
    use: [
    test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
    type: "asset/inline"


    <!DOCTYPE html>
      <title>Flexmonster / Webpack</title>
      <div id="pivot"></div>
      <script src="bundle.js"></script>

    What’s next?

    You may be interested in the following articles: