Breaking Changes in SciChart.js v6.0 from v5.2
This page lists every breaking change between SciChart.js v5.2 and v6.0, with before/after code for each one.
Package now ships dual CJS + ESM builds
To enable tree-shaking in modern bundlers, scichart now ships both a CommonJS and an ES-module build. The compiled files that previously sat at the package root have moved into two subfolders — cjs/ (CommonJS, resolved by require) and esm/ (ES modules, resolved by import). This is wired through the package's exports map, its main/module/types fields, and a per-folder sideEffects list.
- Root-barrel imports are unaffected.
import { SciChartSurface } from "scichart"continues to work unchanged, and now tree-shakes on bundlers that honourexports+sideEffects— barrel imports no longer pull in the whole library. - Deep imports on modern tooling are unaffected. The import string is unchanged (
import { NumericAxis } from "scichart/Charting/Visuals/Axis/NumericAxis"). Any tooling that understands theexportsfield (webpack 5, Vite, Rollup, esbuild, TypeScript 4.7+ withnode16/nodenext/bundlerresolution) maps the same path to the new physical location automatically. - Deep imports on legacy tooling that ignores
exportsare broken. Toolchains that do not read theexportsfield (webpack 4, the Jest default resolver, TypeScript pre-4.7 classic resolution) will no longer resolvescichart/Charting/...at the old package-root location. Fix by either upgrading the tooling, or importing from the package root"scichart". - Native Node.js ESM (no bundler) is not a target of this build. The
esm/output is intended for consumption through a bundler. Importing it directly under Node's native ESM loader is not supported in this release — use a bundler, or the CJS build viarequire.
Enabling tree-shaking in a TypeScript project
To actually benefit from tree-shaking, your bundler must see ES-module syntax. A bundler picks the ESM build via the import condition only when the code importing scichart reaches it as ESM.
In particular, TypeScript projects using ts-loader/ts-jest with "module": "commonjs" will NOT tree-shake — TypeScript downlevels your import to require("scichart") before webpack sees it, so webpack resolves the require condition and pulls the non-shakeable CommonJS build, bundling the whole library. To get shaking in a TypeScript + webpack app, set in your tsconfig.json:
{
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler"
}
}
Use "module": "esnext" to keep ES import/export for the bundler to shake, and "moduleResolution": "bundler" (TypeScript 5.0+) to resolve SciChart's exports map the same way the bundler does.
Plain-JavaScript projects using native import already get this automatically. This is guidance rather than a breaking change — a commonjs TypeScript project keeps working, it just won't shrink.
Some types have moved to resolve circular dependencies
To resolve circular dependencies and enable tree-shaking, some types have been moved to new files.
These are only breaking if you import directly from internal file paths, for example scichart/Charting/.... Importing from the package root "scichart" is unaffected.