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

icejs 禁用运行时能力后使用约定式路由能力 #3322

Closed
ClarkXia opened this issue Jul 6, 2020 · 3 comments
Closed

icejs 禁用运行时能力后使用约定式路由能力 #3322

ClarkXia opened this issue Jul 6, 2020 · 3 comments
Assignees
Milestone

Comments

@ClarkXia
Copy link
Collaborator

ClarkXia commented Jul 6, 2020

背景

icejs 的运行时能力屏蔽了应用入口相关的执行逻辑,历史项目可以通过 disableRuntime 快速升级到 icejs。
但历史项目类型中存在使用基础插件搭配约定式路由能力的场景。期望 icejs 在关闭运行时能力的同时,可以提供约定式路由开启使用的方式。

@chenbin92
Copy link
Collaborator

chenbin92 commented Jul 16, 2020

需求

  1. build.json 中配置 disableRuntime 之后,使用约定式路由项目能正常构建 & 运行。
{
  "disableRuntime": true 
}
  1. 可以用 basic-spa 为示例,删除 src/routes.ts 然后启动项目正常运行。

方案

  1. 约定式路由即默认不需要配置路由,在 icejs 中的规则是如果 src/routes.js 不存在,即当做约定式路由处理。

  2. 配置 disableRuntime 之后,在内置插件配置中需要添加 build-plugin-ice-router 插件即支持约定式路由功能。

if (userConfig.disableRuntime) {
    return [
      'build-plugin-react-app',
      'build-plugin-ice-mpa',
      'build-plugin-ice-router'
    ];
  }
  1. 禁用 disableRuntime 逻辑之后,build-plugin-ice-core 插件不在生效即相关路由配置也不再生效,可能会报错,根据错误进行解决。

其他

@LanceZhu
Copy link
Collaborator

disableRuntime 后 import { logger } from 'ice' 等内置能力同样不生效。

@chenbin92 chenbin92 added this to the v1.7.0 milestone Jul 17, 2020
@chenbin92 chenbin92 mentioned this issue Aug 13, 2020
@chenbin92 chenbin92 assigned chenbin92 and ClarkXia and unassigned LanceZhu Sep 21, 2020
@chenbin92 chenbin92 modified the milestones: v1.7.0, 1.9.5 Sep 21, 2020
@chenbin92 chenbin92 modified the milestones: 1.9.5, 1.9.8 Oct 14, 2020
@chenbin92
Copy link
Collaborator

结论:不单独开放这个能力,直接使用最新版 icejs。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants