cocoscreator2.4.3 bundle 打包依赖protobuff 问题

  • Creator 版本: 2.4.3

  • 目标平台: Android 和 build web

  • 重现方式:

  • 首个报错:
    index.js:11 Uncaught Error: Cannot find module ‘minimal’
    at s (index.js:11)
    at s (index.js:10)
    at s (index.js:9)
    at index.js:20
    at Object.window.__require.game_7313.protobufjs/minimal (index.js:4725)
    at s (index.js:18)
    at index.js:20

调试模式是正常的build之后就报错
引发的代码 bundle 中的代码
var $protobuf = require(“protobufjs/minimal”);

不是bundle中的代码调用正常
bundle中编译生成有一行代码是
“protobufjs/minimal”: void 0

不是bundle中正常的一行代码是
“protobufjs/minimal”: 8

怀疑bundle中依赖protobufjs的代码没编译进来