sakitam-fdd / ol3Echarts

:earth_asia: :bar_chart: ol3Echarts | a openlayers extension to echarts
https://sakitam-fdd.github.io/ol3Echarts/#/index
Other
322 stars 81 forks source link

ol@7.5.2 使用ol-echarts@4 报错 Cannot read properties of undefined (reading 'split') #120

Closed luoxiao-supermap closed 3 months ago

luoxiao-supermap commented 3 months ago

ol@7.5.2 使用ol-echarts@4 报错 Cannot read properties of undefined (reading 'split') ol@7.5.2的VERSION 是挂在 ol.util.VERSION image

sakitam-fdd commented 3 months ago

@luoxiao-supermap 感谢,看到了你的 PR,但是有个问题: 我看从 7.5.2 版本一直到 9.x, VERSION 字段在主文件都有导出 https://github.com/openlayers/openlayers/blob/v7.5.2/src/ol/index.js 有没有可能是其他问题

luoxiao-supermap commented 3 months ago

打包可能也有问题吧, external里面 ‘ol’ : ‘ol’ ; 没有 'ol/util': 'ol.util'

sakitam-fdd commented 3 months ago

打包可能也有问题吧, external里面 ‘ol’ : ‘ol’ ; 没有 'ol/util': 'ol.util'

倒不是导出的问题,就是默认从 5.0 版本起,所有的 VERSION 字段都是可以从 ol 直接导出的 https://github.com/openlayers/openlayers/blob/v7.5.2/src/ol/index.js 你那边能否提供最小可复现示例

luoxiao-supermap commented 3 months ago

https://jsfiddle.net/owhpy4vs/4/ ![Uploading image.png…]()

luoxiao-supermap commented 3 months ago

image

sakitam-fdd commented 3 months ago

@luoxiao-supermap 好的,收到,我来看下

sakitam-fdd commented 3 months ago

大致确认是 VERSION 的问题,ol 在生成 umd 的时候这个字段好像丢失了,在 esm 下是正常的

sakitam-fdd commented 3 months ago

@luoxiao-supermap 麻烦重新发一下 PR 到 master 吧,dev 分支是废弃的,顺便 rollup 的配置页改下,感谢

external

module.exports = [
  'ol',
  'ol/util',
  'ol/layer',
  'ol/source',
  'ol/proj',
  'openlayers'
];

globals

module.exports = {
  'ol': 'ol',
  'ol/util': 'ol.util',
  'ol/layer': 'ol.layer',
  'ol/source': 'ol.source',
  'ol/proj': 'ol.proj',
  'openlayers': 'ol',
};
luoxiao-supermap commented 3 months ago

已提交到master