Skip to main content
Highcharts provides a flexible build system that allows you to create custom, optimized bundles containing only the features you need. This reduces file size and improves performance.

Build System Overview

Highcharts uses a modular build system powered by:
  • TypeScript - Source code in ts/ directory
  • Gulp - Build orchestration and task automation
  • @highcharts/highcharts-assembler - Module bundling and assembly
  • SWC - Fast JavaScript/TypeScript compilation and minification
  • Webpack - Module bundling for ES modules

Understanding the Module System

Highcharts is structured as ES6 modules that can be assembled in different ways:

Build Commands

Creating a Custom Build

1

Identify Required Modules

Determine which Highcharts features you need:
2

Use ES Modules

Import only what you need:
3

Bundle with Your Tool

Use your preferred bundler:

Build Configuration

TypeScript Configuration

The main TypeScript configuration is in ts/tsconfig.json:

Compilation Process

Highcharts uses SWC for fast compilation and minification:

Using Highcharts Assembler

The @highcharts/highcharts-assembler package builds distributable modules:

Tree Shaking with Modern Bundlers

Modern bundlers like Webpack 5, Rollup, and Vite support tree shaking with Highcharts ES modules, automatically removing unused code.

Optimizing Build Size

1

Use ES Modules

Always prefer ES modules for better tree shaking:
2

Import Only Needed Modules

3

Enable Compression

Configure your bundler for optimal compression:

Build Products

Highcharts supports building different products:

Custom Build Examples

Minimal Chart Build

Stock Chart with Indicators

Chart with Exporting

Development Workflow

1

Start Watch Mode

This watches TypeScript files and rebuilds on changes.
2

Make Changes

Edit files in the ts/ directory:
3

Test Changes

The build system automatically compiles to code/es-modules/:

CI/CD Integration

Custom builds may not receive automatic updates. When upgrading Highcharts, rebuild your custom bundle to get the latest features and fixes.

Performance Tips

  1. Use specific imports - Avoid importing the entire library
  2. Enable minification - Always minify production builds
  3. Enable gzip/brotli - Configure your server for compression
  4. Use CDN for common builds - Let browsers cache standard builds
  5. Lazy load modules - Load optional features on demand

Troubleshooting

Build Fails with TypeScript Errors

Module Not Found

Ensure the module path is correct:

Large Bundle Size

Analyze your bundle: