umijs / mako

An extremely fast, production-grade web bundler based on Rust.
https://makojs.dev
MIT License
1.9k stars 75 forks source link

一些构建成功但运行时会失败的包 #372

Closed sorrycc closed 5 months ago

sorrycc commented 1 year ago

具体原因待排查。

@antv/g6-react-node@1.4.5
ReferenceError: _a is not defined
    at http://localhost:8765/all_vendors-async.js:13768:24
    at http://localhost:8765/all_vendors-async.js:14772:19
    at ./node_modules/.pnpm/yoga-layout-prebuilt@1.10.0/node_modules/yoga-layout-prebuilt/yoga-layout/dist/entry-browser.js (http://localhost:8765/all_vendors-async.js:38680:13)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./node_modules/.pnpm/@antv+g6-react-node@1.4.5/node_modules/@antv/g6-react-node/dist/index.esm.js (http://localhost:8765/all_vendors-async.js:71403:67)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./index.ts (http://localhost:8765/index.js:398:56)
    at requireModule (http://localhost:8765/index.js:29:33)

@gedit/resource@0.2.10
TypeError: Reflect.hasOwnMetadata is not a function
    at _tagParameterOrProperty (http://localhost:8765/all_vendors-async.js:2056:29)
    at Object.tagParameter (http://localhost:8765/all_vendors-async.js:2041:17)
    at http://localhost:8765/all_vendors-async.js:1797:43
    at http://localhost:8765/all_vendors-async.js:5848:21
    at __decorate (http://localhost:8765/all_vendors-async.js:5840:105)
    at ./node_modules/.pnpm/@gedit+command@0.2.9/node_modules/@gedit/command/lib/common/command.js (http://localhost:8765/all_vendors-async.js:6066:31)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./node_modules/.pnpm/@gedit+command@0.2.9/node_modules/@gedit/command/lib/common/index.js (http://localhost:8765/all_vendors-async.js:6236:26)
    at requireModule (http://localhost:8765/index.js:29:33)

assets@3.0.1
TypeError: Cannot read properties of undefined (reading 'call')
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at http://localhost:8765/all_vendors-async.js:663:36
    at Array.forEach (<anonymous>)
    at ./node_modules/.pnpm/assets@3.0.1/node_modules/assets/lib/index.js (http://localhost:8765/all_vendors-async.js:662:15)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./index.ts (http://localhost:8765/index.js:398:51)
    at requireModule (http://localhost:8765/index.js:29:33)
    at http://localhost:8765/index.js:382:9</anonymous>

bizcharts-plugin-slider@2.1.1
TypeError: Cannot read properties of undefined (reading 'Util')
    at Object.<anonymous> (http://localhost:8765/all_vendors-async.js:2226:72)
    at e (http://localhost:8765/all_vendors-async.js:2043:49)
    at Object.<anonymous> (http://localhost:8765/all_vendors-async.js:2068:45)
    at e (http://localhost:8765/all_vendors-async.js:2043:49)
    at Object.<anonymous> (http://localhost:8765/all_vendors-async.js:2064:45)
    at e (http://localhost:8765/all_vendors-async.js:2043:49)
    at http://localhost:8765/all_vendors-async.js:2061:46
    at http://localhost:8765/all_vendors-async.js:2062:30
    at http://localhost:8765/all_vendors-async.js:2033:41
    at Object.<anonymous> (http://localhost:8765/all_vendors-async.js:2034:26)</anonymous></anonymous></anonymous></anonymous>

bizcharts-plugin-slider@3.0.1
TypeError: Cannot read properties of undefined (reading 'Util')
    at Object.<anonymous> (http://localhost:8765/all_vendors-async.js:2226:72)
    at e (http://localhost:8765/all_vendors-async.js:2043:49)
    at Object.<anonymous> (http://localhost:8765/all_vendors-async.js:2068:45)
    at e (http://localhost:8765/all_vendors-async.js:2043:49)
    at Object.<anonymous> (http://localhost:8765/all_vendors-async.js:2064:45)
    at e (http://localhost:8765/all_vendors-async.js:2043:49)
    at http://localhost:8765/all_vendors-async.js:2061:46
    at http://localhost:8765/all_vendors-async.js:2062:30
    at http://localhost:8765/all_vendors-async.js:2033:41
    at Object.<anonymous> (http://localhost:8765/all_vendors-async.js:2034:26)</anonymous></anonymous></anonymous></anonymous>

calc-js@1.3.0
ReferenceError: define is not defined
    at ./node_modules/.pnpm/calc-js@1.3.0/node_modules/calc-js/dist/index.js (http://localhost:8765/all_vendors-async.js:56:13)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./index.ts (http://localhost:8765/index.js:398:51)
    at requireModule (http://localhost:8765/index.js:29:33)
    at http://localhost:8765/index.js:382:9

china-division@2.6.1
ReferenceError: __dirname is not defined
    at ./node_modules/.pnpm/china-division@2.6.1/node_modules/china-division/lib/export.js (http://localhost:8765/all_vendors-async.js:421:49)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./index.ts (http://localhost:8765/index.js:398:58)
    at requireModule (http://localhost:8765/index.js:29:33)
    at http://localhost:8765/index.js:382:9

d3@3.5.17
TypeError: Cannot read properties of undefined (reading 'document')
    at http://localhost:8765/all_vendors-async.js:63:40
    at ./node_modules/.pnpm/d3@3.5.17/node_modules/d3/d3.js (http://localhost:8765/all_vendors-async.js:10840:14)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./index.ts (http://localhost:8765/index.js:398:47)
    at requireModule (http://localhost:8765/index.js:29:33)
    at http://localhost:8765/index.js:382:9

kindeditor@4.1.10
ReferenceError: _instances is not defined
    at http://localhost:8765/all_vendors-async.js:5562:28
    at ./node_modules/.pnpm/kindeditor@4.1.10/node_modules/kindeditor/kindeditor-all.js (http://localhost:8765/all_vendors-async.js:6105:15)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./index.ts (http://localhost:8765/index.js:398:55)
    at requireModule (http://localhost:8765/index.js:29:33)
    at http://localhost:8765/index.js:382:9

qrcodejs2@0.0.2
TypeError: Cannot read properties of undefined (reading '_android')
    at http://localhost:8765/all_vendors-async.js:2514:30
    at http://localhost:8765/all_vendors-async.js:2622:18
    at http://localhost:8765/all_vendors-async.js:58:66
    at ./node_modules/.pnpm/qrcodejs2@0.0.2/node_modules/qrcodejs2/qrcode.js (http://localhost:8765/all_vendors-async.js:61:15)
    at requireModule (http://localhost:8765/index.js:29:33)
    at fn (http://localhost:8765/index.js:64:24)
    at ./index.ts (http://localhost:8765/index.js:398:54)
    at requireModule (http://localhost:8765/index.js:29:33)
    at http://localhost:8765/index.js:382:9
HiLanXiao commented 1 year ago

怎么复现呢,是在哪个 example 里发现的呢👀

PeachScript commented 1 year ago

这个应该是跑脚本发现的,这样应该可以复现:

  1. 任意 example 安装这个包
  2. entry 里引入它:
    import * as xx from 'yy';
    console.log(xx);
  3. 执行构建
HiLanXiao commented 1 year ago

@antv/g6-react-node:

HiLanXiao commented 1 year ago

gedit/resource@0.2.10 暂时没复现,我这边 umi 跟 mako 都能正常跑起来

HiLanXiao commented 1 year ago

assets@3.0.1 require assets 时执行了包内部的 require 逻辑,但 './data'、'./path' 这种 module 是找不到的 image image

HiLanXiao commented 1 year ago

bizcharts-plugin-slider@2.1.1 bizcharts-plugin-slider@3.0.1 umi 跑也是同样的报错,暂时先略过

HiLanXiao commented 1 year ago

calc-js@1.3.0 看起来是我们的 require 没支持 AMD 规范 define 的缘故,用了 define 的包应该都会有问题(webpack 支持了

HiLanXiao commented 1 year ago

china-division@2.6.1 __dirname 我们没处理,看起来 webpack 处理了

HiLanXiao commented 1 year ago

d3@3.5.17 跟第一个问题类似,在 execOptions.factory.call 里调用时 this 不再指向 window 了,所以会报错 image

HiLanXiao commented 1 year ago

kindeditor@4.1.10 这个跟第一个是一样的问题,给一个未声明的变量赋值时,全局作用域下才不会报错 image

HiLanXiao commented 1 year ago

qrcodejs2@0.0.2 这个是 this 为空了,还是得看看 execOptions.factory.call 那边的实现,umi 下这块是 window 的 image

HiLanXiao commented 1 year ago

总结一下: