diff --git a/src/core/echarts.ts b/src/core/echarts.ts index 1c342ce413..7757dd22fc 100644 --- a/src/core/echarts.ts +++ b/src/core/echarts.ts @@ -412,20 +412,19 @@ class ECharts extends Eventful { let defaultRenderer = 'canvas'; let defaultCoarsePointer: 'auto' | boolean = 'auto'; let defaultUseDirtyRect = false; + if (__DEV__) { const root = ( /* eslint-disable-next-line */ env.hasGlobalWindow ? window : global ) as any; - defaultRenderer = root.__ECHARTS__DEFAULT__RENDERER__ || defaultRenderer; - - defaultCoarsePointer = retrieve2(root.__ECHARTS__DEFAULT__COARSE_POINTER, defaultCoarsePointer); + if (root) { + defaultRenderer = retrieve2(root.__ECHARTS__DEFAULT__RENDERER__, defaultRenderer); + defaultCoarsePointer = retrieve2(root.__ECHARTS__DEFAULT__COARSE_POINTER, defaultCoarsePointer); + defaultUseDirtyRect = retrieve2(root.__ECHARTS__DEFAULT__USE_DIRTY_RECT__, defaultUseDirtyRect); + } - const devUseDirtyRect = root.__ECHARTS__DEFAULT__USE_DIRTY_RECT__; - defaultUseDirtyRect = devUseDirtyRect == null - ? defaultUseDirtyRect - : devUseDirtyRect; } const zr = this._zr = zrender.init(dom, {