If you are interested in learning more about it, please visit my personal website: Yetong Space
I am calling the init method of zrender to report an error, as shown below:
Then, after being pointed out by the boss, this kind of development environment is fine, but the production environment reports an error, usually because it was dropped by tree-shaking during packaging.
After debugging+ looking at the source code, it is found that the registerPainter method is missing.
Imitate the source code to call:
import {
init } from "zrender";
import {
registerPainter } from 'zrender';
import CanvasPainter from 'zrender/lib/canvas/Painter';
import SVGPainter from 'zrender/lib/svg/Painter';
registerPainter('canvas', CanvasPainter);
registerPainter('svg', SVGPainter);
problem solved. What an amazing experience.
By the way, this project is already online and open source, address: http://stars.eyescode.top