Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taro3.0.2 Error: Route not found #7008

Closed
moyupoi opened this issue Jul 13, 2020 · 5 comments · Fixed by #7359
Closed

taro3.0.2 Error: Route not found #7008

moyupoi opened this issue Jul 13, 2020 · 5 comments · Fixed by #7359
Assignees
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Milestone

Comments

@moyupoi
Copy link

moyupoi commented Jul 13, 2020

相关平台

H5

复现仓库

http://xxx/womobile/list
浏览器版本: chrome 83.0.4103.116
使用框架: React

复现步骤

路由配置

h5: {
    esnextModules: ['taro-ui'],
    devServer: {
      port: 3000,
      https: false
    },
    publicPath: `/womobile`,
    router: {
      basename: '/womobile',
      mode: 'browser',
      customRoutes: {
        '/pages/index/index': '/index',
        '/pages/list/list': '/list',
        '/pages/details/details': '/details',
      }
    },
    sassLoaderOption: {
      implementation: require("dart-sass")
    }
  }

src/app.config.js 配置

export default {
  pages: [
    'pages/index/index',
    'pages/list/list',
    'pages/details/details',
  ],
  window: {
    backgroundTextStyle: 'light',
    navigationBarBackgroundColor: '#fff',
    navigationBarTitleText: 'WeChat',
    navigationBarTextStyle: 'black'
  }
}

跳转方式:
Taro.navigateTo({ url: pages/details/details?woId=${woId} })

报错:
Error: Route not found

期望结果

期望能正常跳转

实际结果

Error: Route not found

环境信息

 Taro CLI 3.0.2 environment info:
    System:
      OS: macOS 10.15.5
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 14.4.0 - /usr/local/bin/node
      Yarn: 1.22.4 - ~/.yarn/bin/yarn
      npm: 6.14.5 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.2 => 3.0.2
      @tarojs/mini-runner: 3.0.2 => 3.0.2
      @tarojs/react: 3.0.2 => 3.0.2
      @tarojs/runtime: 3.0.2 => 3.0.2
      @tarojs/taro: 3.0.2 => 3.0.2
      @tarojs/webpack-runner: 3.0.2 => 3.0.2
      babel-preset-taro: 3.0.2 => 3.0.2
      eslint-config-taro: 3.0.2 => 3.0.2
      nervjs: ^1.5.7 => 1.5.7
      react: ^16.10.0 => 16.13.1
      taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.3

@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Jul 13, 2020
@moyupoi
Copy link
Author

moyupoi commented Jul 13, 2020

Taro.navigateTo({ url: /details?woId=${woId} })
发现3.0.2之后这样可以,但兼容小程序就比较麻烦了,还有,const { router } = getCurrentInstance() 拿不到woId参数

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 17, 2020

@tuoxie15 提供一下可复现 demo

@Chen-jj Chen-jj modified the milestones: 3.0.7, 3.0.8 Jul 30, 2020
@7gongzi
Copy link

7gongzi commented Aug 7, 2020

同遇到同样问题 严重影响升级进度。。。。
Taro:3.0.7
配置customRoutes ,
image
针对上面的配置,调用 Taro.navigateTo({ url: '/pages/index/index' }) 后,会报错
image

@luckyadam
Copy link
Member

3.0.8 可用

@AshaLiu
Copy link

AshaLiu commented Aug 18, 2020

3.0.8 可用

3.0.8 可用

3.0.8发了吗 我看最新的是3.0.7啊 还是存在build:h5 Route not found的问题

@Chen-jj Chen-jj linked a pull request Aug 19, 2020 that will close this issue
20 tasks
Chen-jj added a commit that referenced this issue Aug 19, 2020
* fix(router): 修复配置 customRoutes 后路由跳转问题,close #7008

* fix(router): 修复 h5 对 onReachBottom 的支持

* feat(mini-runner): 支持小程序全局注册组件,close #7098

* fix(mini-runner): 去除与原生小程序混写时生成冗余代码,close #7172

* fix(helper): babel-register解析忽略项目 babelrc 配置文件,close #6821

* fix(taro): 修复 getComputedStyle 报错问题,close #7185

* fix(runtime): 修复使用 taro 代码开发自定义 tabbar 报错

* fix(webpack-runner): 修复使用 nerv 框架时组件样式设置不上的问题,close #7310

Co-authored-by: chenjiajian <798095202@qq.com>
@ZakaryCode ZakaryCode added this to H5 Apr 10, 2023
@ZakaryCode ZakaryCode moved this to Done in H5 Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants