Skip to content

Commit

Permalink
Merge pull request #15405 from guoenxuan/fix-hook-navigateto
Browse files Browse the repository at this point in the history
fix(harmony-hybrid): 修复路由函数无法hook的问题
  • Loading branch information
qican777 authored Mar 29, 2024
2 parents ba27009 + f28ed22 commit 4153b76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/taro-platform-harmony-hybrid/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,17 @@ export default class H5 extends TaroPlatformWeb {
const rules = chain.module.rules
const script = rules.get('script')
const babelLoader = script.uses.get('babelLoader')
const routerApis = new Set(['navigateTo', 'navigateBack', 'redirectTo', 'reLaunch', 'switchTab'])
let apis = require(resolveSync('./taroApis'))
apis = new Set(Array.from(apis).filter((x: string) => !routerApis.has(x)))
babelLoader.set('options', {
...babelLoader.get('options'),
plugins: [
[
require('babel-plugin-transform-taroapi'),
{
packageName: '@tarojs/taro',
apis: require(resolveSync('./taroApis')),
apis,
definition: require(this.libraryDefinition)
}
]
Expand Down

0 comments on commit 4153b76

Please sign in to comment.