wgt-node-utils 0.0.24 → 0.0.26

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgt-node-utils",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "WGT工具类包",
5
5
  "main": "dist/bundle.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -432,7 +432,6 @@ class wgtNodeUtils {
432
432
  name: 'English',
433
433
  icon: 'cfgv1bursfevmln3akj0.webp'
434
434
  }]
435
- console.log(axios, 'axios')
436
435
  console.log(url, 'url')
437
436
  return new Promise((resolve) => {
438
437
  axios.get(url).then(res => {
@@ -447,7 +446,7 @@ class wgtNodeUtils {
447
446
  });
448
447
  resolve(list || defaultLanList);
449
448
  }).catch((e) => {
450
- console.log(e)
449
+ console.log(e, 'axios 报错信息')
451
450
  this.appendLog('语言读取', '语言接口调用失败', 'test', components = '');
452
451
  // 调用失败时,返回en
453
452
  resolve(defaultLanList);
@@ -455,6 +454,11 @@ class wgtNodeUtils {
455
454
  });
456
455
  }
457
456
 
457
+ /**
458
+ * 检查域名是否可用
459
+ * @param {url:string} url
460
+ * @returns
461
+ */
458
462
  checkDomainAvailability = (url) => {
459
463
  return new Promise((resolve, reject) => {
460
464
  const { hostname, path } = new URL(url);
package/webpack.config.js CHANGED
@@ -6,7 +6,8 @@ module.exports = {
6
6
  filename: 'bundle.js', // 输出的文件名
7
7
  library: 'wgtNodeUtils', // 暴露库名
8
8
  libraryTarget: 'umd', // 使用 UMD 规范
9
- globalObject: 'this'
9
+ // 根据运行环境设置全局对象,确保 Node.js 使用 global,浏览器使用 self 或 window
10
+ globalObject: 'typeof self !== "undefined" ? self : global',
10
11
  },
11
12
  module: {
12
13
  rules: [