my-openlayer 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,10 +37,13 @@ function detectVueSync() {
37
37
  // 如果在Node.js环境中,尝试require
38
38
  if (typeof window === 'undefined') {
39
39
  try {
40
- // 使用eval来避免TypeScript编译时的require检查
41
- const requireFunc = eval('require');
42
- Vue = requireFunc('vue');
43
- isVue3 = !!(Vue.version?.startsWith('3') || Vue.createApp);
40
+ // 尝试获取 require 函数,避免使用 eval
41
+ // @ts-ignore
42
+ const requireFunc = typeof __non_webpack_require__ === 'function' ? __non_webpack_require__ : (typeof module !== 'undefined' && module.require ? module.require : undefined);
43
+ if (requireFunc) {
44
+ Vue = requireFunc('vue');
45
+ isVue3 = !!(Vue.version?.startsWith('3') || Vue.createApp);
46
+ }
44
47
  }
45
48
  catch (e) {
46
49
  ErrorHandler.getInstance().warn('Vue not found. Please ensure Vue is installed in your project.');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-openlayer",
3
3
  "private": false,
4
- "version": "2.4.1",
4
+ "version": "2.4.2",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",