Skip to content

Commit

Permalink
fix: 修复__wxConfig报错
Browse files Browse the repository at this point in the history
  • Loading branch information
Ackites committed Aug 12, 2024
1 parent 2b1686d commit e3a0830
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions internal/unpack/ujs.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ func (p *JavaScriptParser) Parse(option config.WxapkgInfo) error {
}

// 防止报错
patch := `var window={};var navigator={};navigator.userAgent="iPhone";window.screen={};document={};function require(){};`
patch := `var window={};var navigator={};navigator.userAgent="iPhone";window.screen={};
document={getElementsByTagName:()=>{}};function require(){};`

scriptcode := patch + string(code)

Expand Down Expand Up @@ -114,12 +115,12 @@ func (p *JavaScriptParser) Parse(option config.WxapkgInfo) error {
// return err
//}
//
//// 提供 __wxConfig 变量的默认实现
//err = vm.Set("__wxConfig", make(map[string]interface{}))
//if err != nil {
// return err
//}
//
// 提供 __wxConfig 变量的默认实现
err = vm.Set("__wxConfig", make(map[string]interface{}))
if err != nil {
return err
}

//// 提供 global 变量的默认实现
//err = vm.Set("global", make(map[string]interface{}))
//if err != nil {
Expand Down

0 comments on commit e3a0830

Please sign in to comment.