Skip to content

Commit

Permalink
fix: 修复支付宝小程序开发预览报错问题 (#16715)
Browse files Browse the repository at this point in the history
* chore: 补全缺失的依赖 #16515

* feat(alipay): 新增 browserslist 配置 #16560
  • Loading branch information
koppthe authored Oct 16, 2024
1 parent 5148dd6 commit e1aa8a8
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/taro-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"dependencies": {
"@tarojs/binding": "workspace:*",
"@tarojs/helper": "workspace:*",
"@tarojs/plugin-doctor": "^0.0.13",
"@tarojs/service": "workspace:*",
"@tarojs/shared": "workspace:*",
"@tarojs/plugin-doctor": "^0.0.13",
"adm-zip": "^0.5.12",
"axios": "^1.6.8",
"cli-highlight": "^2.1.11",
Expand All @@ -60,11 +60,11 @@
},
"devDependencies": {
"@babel/types": "^7.24.0",
"@tarojs/taro": "workspace:*",
"@tarojs/plugin-platform-weapp": "workspace:*",
"@tarojs/plugin-platform-h5": "workspace:*",
"@tarojs/plugin-platform-weapp": "workspace:*",
"@tarojs/taro": "workspace:*",
"@tarojs/webpack5-runner": "workspace:*",
"@types/babel__traverse": "^7.20.2",
"@types/babel__traverse": "^7.20.6",
"babel-preset-taro": "workspace:*",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.4.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-cli/src/util/createPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { babelKit } from '@tarojs/helper'

import { ConfigModificationState, ModifyCallback } from '../create/page'

import type { NodePath } from '@babel/traverse'
import type { ArrayExpression, ExportDefaultDeclaration, ObjectExpression, ObjectProperty } from '@babel/types'
import type { NodePath } from 'babel__traverse'

const t = babelKit.types

Expand Down
8 changes: 8 additions & 0 deletions packages/taro-extend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@
},
"engines": {
"node": ">= 18"
},
"devDependencies": {
"@tarojs/runtime": "workspace:*",
"@tarojs/taro": "workspace:*"
},
"peerDependencies": {
"@tarojs/runtime": "workspace:*",
"@tarojs/taro": "workspace:*"
}
}
16 changes: 16 additions & 0 deletions packages/taro-platform-alipay/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class Alipay extends TaroPlatformBase {
this.modifyMiniConfigs()
this.modifyComponents()
this.modifyWebpackConfig()
this.generateBrowserslistConfig()
this.generateProjectConfig('project.alipay.json', 'mini.project.json')
}
})
Expand Down Expand Up @@ -106,4 +107,19 @@ export default class Alipay extends TaroPlatformBase {
})
})
}

/**
* 生成 .browserslistrc 文件以解决支付宝小程序开发工具报错问题。
* 详情请参阅:https://github.com/NervJS/taro/issues/16560
*/
generateBrowserslistConfig () {
this.ctx.modifyBuildAssets(({ assets }) => {
const browserslistStr = 'defaults and fully supports es6-module'

assets['.browserslistrc'] = {
size: () => browserslistStr.length,
source: () => browserslistStr
}
})
}
}
7 changes: 5 additions & 2 deletions packages/taro-platform-tt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@
"engines": {
"node": ">= 18"
},
"dependencies": {
"webpack-sources": "^3.2.3"
},
"devDependencies": {
"@tarojs/components": "workspace:*",
"@tarojs/service": "workspace:*",
"@tarojs/shared": "workspace:*"
},
"peerDependencies": {
"@tarojs/shared": "workspace:*",
"@tarojs/service": "workspace:*"
"@tarojs/service": "workspace:*",
"@tarojs/shared": "workspace:*"
}
}
1 change: 1 addition & 0 deletions packages/taro-router-rn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@react-navigation/native-stack": "^6.3.29",
"@react-navigation/routers": "^6.1.9",
"@react-navigation/stack": "^6.3.29",
"lodash": "^4.17.21",
"query-string": "^9.0.0",
"react-native-gesture-handler": "^2.16.0",
"react-native-safe-area-context": "4.5.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/taro-transformer-wx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
"@babel/types": "^7.24.0",
"@tarojs/helper": "workspace:*",
"babel-eslint": "^10.0.1",
"babel-helper-evaluate-path": "^0.5.0",
"babel-helper-mark-eval-scopes": "^0.4.3",
"babel-helper-remove-or-void": "^0.4.3",
"babel-plugin-preval": "^5.1.0",
"babel-plugin-transform-define": "^2.1.4",
"eslint": "^8.57.0",
Expand Down
1 change: 1 addition & 0 deletions packages/taroize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@tarojs/helper": "workspace:*",
"@tarojs/shared": "workspace:*",
"himalaya-wxml": "^1.1.0",
"html": "^1.0.0",
"lodash": "^4.17.21",
"prettier": "^2.8.8"
},
Expand Down
37 changes: 35 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e1aa8a8

Please sign in to comment.