@cloudbase/lowcode-builder 1.10.27 → 1.10.28

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.
@@ -100,17 +100,13 @@ module.exports = function (options) {
100
100
  }),
101
101
  new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
102
102
  new webpack.NormalModuleReplacementPlugin(
103
- /@\/components\/(?!ui)(.*)|^@\/lib|^@\/configs|^@\/components$/, // 使用否定前瞻匹配除ui外的所有路径
103
+ /@\/components\/(?!ui)(.*)|^@\/(lib|hooks|configs)|^@\/components$/, // 使用否定前瞻匹配除ui外的所有路径
104
104
  function (resource) {
105
- if (/lowcode\/(pages|components|lib|configs)/.test(resource.context)) {
106
- if (/\@\/lib\/(.*)/.test(resource.request)) {
107
- resource.request = resource.request.replace(/\@\/lib\/(.*)/, '@/lowcode/lib/$1');
108
- } else if (/\@\/configs\/(.*)/.test(resource.request)) {
109
- resource.request = resource.request.replace(/\@\/configs\/(.*)/, '@/lowcode/configs/$1');
110
- } else if (/\@\/components\/(.*)/.test(resource.request)) {
111
- resource.request = resource.request.replace(/\@\/components\/(.*)/, '@/lowcode/components/$1');
112
- } else if (resource.request === '@/components') {
105
+ if (/lowcode\//.test(resource.context)) {
106
+ if (resource.request === '@/components') {
113
107
  resource.request = '@/lowcode/components/index';
108
+ } else {
109
+ resource.request = resource.request.replace(/\@\//, '@/lowcode/');
114
110
  }
115
111
  }
116
112
  },
@@ -207,6 +203,7 @@ module.exports = function (options) {
207
203
  });
208
204
  }
209
205
 
206
+ let hasUtils = false;
210
207
  return {
211
208
  context,
212
209
  entry: './src/index.jsx',
@@ -256,6 +253,25 @@ module.exports = function (options) {
256
253
  }
257
254
  callback();
258
255
  },
256
+ function (context, request, callback) {
257
+ if (/lowcode\//.test(context) && request === '@/lib/utils') {
258
+ const fs = require('fs');
259
+ // 构建要检查的文件路径:项目根目录下的lowcode/lib/utils
260
+ const filePath = path.join(context, 'src', 'lowcode', 'lib');
261
+ if (
262
+ hasUtils ||
263
+ fs.existsSync(path.join(filePath, 'utils.js')) ||
264
+ fs.existsSync(path.join(filePath, 'utils.ts'))
265
+ ) {
266
+ hasUtils = true;
267
+ callback();
268
+ } else {
269
+ callback(null, 'window.SHADN._LIB_UTILS');
270
+ }
271
+ } else {
272
+ callback();
273
+ }
274
+ },
259
275
  ],
260
276
  cache: {
261
277
  type: 'memory',