报错信息:
message:subPackageA/pages/index.js: Code protect is not available
in subPackageA/pages/index.js
'require' requires one and only one static string literal
7 | async onLoad() {
8 | const { items } = this.data;
> 9 | require('../../subPackageB/utils.js', utils => {
| ^
10 | items.push(utils.whoami)
11 | this.setData({ items })
12 | })
require is not being used properly in 'MemberExpression'
12 | })
13 |
> 14 | const pkg = await require.async('../../commonPackage/index.js')
| ^
15 | items.push(pkg.getPackageName())
16 | this.setData({ items })
17 | },
appid: wx70e7de8e0ded8d3f
openid: o6zAJs1JE5r8gERMhufJ3i78BkqA
ideVersion: 1.06.2407312
osType: darwin-arm64
time: 2024-08-07 12:50:34
复现场景:开启代码保护+使用分包异步化引入
历史相关文章:
https://developers.weixin.qq.com/community/develop/doc/0002480b450460915d8905d0f5b800
https://developers.weixin.qq.com/community/develop/doc/000ea4888a0928b475ef0413c5b800
期望结果:
对微信侧自己重写的commonjs的require函数在代码保护功能当中实现兼容,保证代码安全性和开发工具更为全面的功能兼容性。