All documentation
  • Introduction
  • Connecting to data source
  • Browser compatibility
  • Documentation for older versions
  • Improving Flexmonster's performance in React

    One of the causes of Flexmonster's slow performance in React is the babel-loader package, which is preinstalled in React applications. By default, babel-loader transpiles all files located in the node_modules/ folder, including Flexmonster files.

    This issue can be fixed by manually configuring babel-loader, which requires running the npm run eject command. Note that this command’s effect is irreversible, so we recommend learning more about npm run eject before running it.

    To improve Flexmonster's performance, follow the steps below:

    Step 1. Run the npm run eject command in the console.

    Step 2. Open the webpack.config.js file and exclude Flexmonster from babel-loader:

    // Process any JS outside of the app with Babel
    // Unlike the application JS, we only compile the standard ES features
    {
      test: /\.(js|mjs)$/,
      exclude: [
        /node_modules[\\/]flexmonster/,
        /@babel(?:\/|\\{1,2})runtime/
      ],
      loader: require.resolve('babel-loader'),
      …
    }

    If you completed the instructions above but the performance is still slow, you can try passing data to the component in a different way.

    For example, data can be aggregated on a server and passed to Flexmonster in a ready-to-show format. This will reduce the load on the browser and improve performance. This approach is implemented in Flexmonster Data Server — our tool for server-side data processing, so you are welcome to use it.

    See also