Skip to content

[Bug]: The latest version seems to have lazy compilation enabled by default, and some other configurations cause lazy-loaded routes to fail to redirect to pages #6494

@moonsky-all

Description

@moonsky-all

Version

System:
    OS: macOS 15.7.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 2.48 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 142.0.7444.60
    Edge: 142.0.3595.53
    Firefox: 131.0
    Safari: 26.0.1
  npmPackages:
    @rsbuild/core: ^1.6.1 => 1.6.1 
    @rsbuild/plugin-less: ^1.5.0 => 1.5.0 
    @rsbuild/plugin-sass: ^1.4.0 => 1.4.0 
    @rsbuild/plugin-vue2: ^1.0.4
    @rsbuild/plugin-vue2-jsx: ^1.0.4

项目其他主要包:
    "vue": "2.7.16",
    "vuex": "3.6.2",
    "vxe-table": "3.8.28",
    "vue-router": "3.6.5",

Details

昨晚看见rsbuild发布了新版本,也加入了不少新特性和性能提升,所以想着尝试一下,我们是 vue2 项目,现在遇到了些问题:

  1. 新版本似乎默认开启了延迟编译,以前用的@rsbuild/core@1.3.22版本,开发启动需38s,现在仅2.5s就启动了,并且在我明确设置performance.buildCache = false后也是如此(当然这本是件好事);
  2. dev.hmrdev.liveReload的响应也和以前不一样了,具体表现是:只有从地址栏输入URL回车时能打开正确页面,但切换页面路由的时候页面不跳转,控制台会提示Hot Module Replacement is not enabled. Waiting for process restart...(因为项目比较大,编辑代码的时候实时频繁刷新页面比较费时,所以我们希望合适的时候手动刷新即可,便将这两个属性都设置了false);
  3. 我们项目默认都用() => import('@/components/...')的方式懒加载所有路由页面,当我们改成非懒加载后,开发启动编译需要约30s,比升级版本之前要快几秒,同时切换路由能跳转页面

Reproduce link

如上

Reproduce Steps

如上

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions