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

fix(umi-build-dev): dynamic import code splitting #460

Merged
merged 2 commits into from
May 14, 2018
Merged

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented May 14, 2018

规则

  • dynamicLevel 默认为 1
  • 根节点下 path 为 / 的 route 如果有 routes,则 dynamicLevel 为 2

例子

无 layout

+ pages
  - a.js
  - b.js
  + c
    - _layout.js
    - c1.js
    - c2.js

note:

  • dynamicLevel 为 1
  • 拆 a.js、b.js、c.js(包含 c1、c2 及其 _layout.js)

有 layout

+ layouts/index.js
+ pages
  - a.js
  - b.js
  + c
    - _layout.js
    - c1.js
    - c2.js

note:

  • dynamicLevel 为 2
  • layouts/index.js 会合并到 common-umi 里
  • 拆 a.js、b.js、c.js(包含 c1、c2 及其 _layout.js)

多 layout

[
  { path: '/login' },
  { path: '/', routes: [
    { path: '/a' },
    { path: '/b' },
    { path: '/c', routes: [
      { path: '/c1' },
      { path: '/c2' },
    ] },
  ]},
]
  • dynamicLevel 为 2
  • 拆 /login 和 /,由于有差异,所以不会自动合并到 common-umi
  • 拆 a.js、b.js、c.js(包含 c1、c2 及其 _layout.js)

@coveralls
Copy link

coveralls commented May 14, 2018

Pull Request Test Coverage Report for Build 385

  • 8 of 12 (66.67%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.3%) to 19.651%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/umi-build-dev/src/getWebpackConfig.js 0 4 0.0%
Files with Coverage Reduction New Missed Lines %
packages/umi-build-dev/src/getWebpackConfig.js 1 0.0%
Totals Coverage Status
Change from base Build 381: 0.3%
Covered Lines: 429
Relevant Lines: 2448

💛 - Coveralls

@sorrycc sorrycc merged commit 3e774d2 into master May 14, 2018
@sorrycc sorrycc deleted the fix/dynamic-import branch May 14, 2018 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants