When upgrading to v4.0, several fundamental changes in package naming and namespaces must be addressed:
Package Name Change
The package has moved to a scoped name. Replace tui-chart with @toast-ui/chart.
Installation:
# v3.x
npm install tui-chart
# v4.0
npm install @toast-ui/chart
Note: Ensure you uninstall tui-chart before installing @toast-ui/chart to avoid duplicates.
Import Changes
Update your import statements to use the new scoped package name.
ES6 Modules:
// v3.x
import Chart from 'tui-chart';
// v4.0
import Chart from '@toast-ui/chart';
// Or import specific charts for smaller bundles
import { BarChart } from '@toast-ui/chart';
CommonJS:
// v3.x
const Chart = require('tui-chart');
// v4.0
const Chart = require('@toast-ui/chart');
Namespace Change
The global namespace has changed from tui to toastui.
Browser Usage:
// v3.x
const chart = tui.Chart.barChart(el, data, options);
// v4.0
const chart = toastui.Chart.barChart({el, data, options});
import { BarChart } from '@toast-ui/chart';