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

[WIP] bugfix: entrance #1502

Closed
wants to merge 1 commit into from
Closed

Conversation

himStone
Copy link

@himStone himStone commented Jun 29, 2017

close #1495

First of all, thank you for your contribution! :-)

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

  • Make sure that you follow antd's code convention.
  • Run npm run lint and fix those errors before submitting in order to keep consistent code style.
  • Rebase before creating a PR to keep commit history clear.
  • Add some descriptions and refer relative issues for you PR.

Extra checklist:

if isBugFix :

  • Make sure that you add at least one unit test for the bug which you had fixed.

elif isNewFeature :

  • Update API docs for the component.
  • Update/Add demo to demonstrate new feature.
  • Update TypeScript definition for the component.
  • Add unit tests for the feature.
  1. 修复item的type报错
[ts] JSX element type 'List.Item' does not have any construct or call signatures.

2. 给两个入口,一个生成混合的ts类型声明(index.tsx),一个给umd之类的打web平台的包(index.web.tsx)

#1339 #1376


This change is Reviewable

@mention-bot
Copy link

@bccsafe, thanks for your PR! By analyzing the history of the files in this pull request, we identified @yiminghe, @warmhug and @silentcloud to be potential reviewers.

@himStone himStone requested review from paranoidjk and warmhug June 29, 2017 02:21
@warmhug
Copy link
Contributor

warmhug commented Jun 29, 2017

需要运行npm run compile并保证不出错,验证构建结果,包括 dist 目录的 js

@himStone
Copy link
Author

@warmhug 目前 npm run compile用的入口文件是什么,index.tsx?能不能让我指定某个文件

@paranoidjk
Copy link
Contributor

@himStone himStone changed the title bugfix: entrance [WIP] bugfix: entrance Jun 29, 2017
@codecov
Copy link

codecov bot commented Jun 29, 2017

Codecov Report

Merging #1502 into master will decrease coverage by 0.95%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1502      +/-   ##
==========================================
- Coverage   64.86%   63.91%   -0.96%     
==========================================
  Files         229      230       +1     
  Lines        2271     2322      +51     
  Branches      699      700       +1     
==========================================
+ Hits         1473     1484      +11     
- Misses        797      837      +40     
  Partials        1        1
Flag Coverage Δ
#rn 79.81% <ø> (ø) ⬆️
#web 63.12% <0%> (-0.99%) ⬇️
Impacted Files Coverage Δ
components/index.tsx 0% <ø> (ø) ⬆️
components/search-bar/index.web.tsx 78.57% <ø> (ø) ⬆️
components/flex/type.tsx 0% <ø> (ø) ⬆️
components/list/type.tsx 0% <ø> (ø) ⬆️
components/index.web.tsx 0% <0%> (ø)
components/segmented-control/index.web.tsx 87.17% <0%> (+28.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67e0ee6...63e5489. Read the comment docs.

@warmhug
Copy link
Contributor

warmhug commented Jun 29, 2017

ref #1495

@himStone
Copy link
Author

@paranoidjk

index.web.js

const req = require.context('./components', true, /^\.\/[^_][\w-]+\/style\/index\.web\.tsx?$/)

我看没有包含type.tsx,奇怪了,umd打包怎么会打包进去的,唯一用到type.tsx的就是src/index.tsx

@paranoidjk
Copy link
Contributor

const req = require.context('./components', true, /^./[^_][\w-]+/style/index.web.tsx?$/)

注意你发的这一行其实是引用样式

https://github.com/ant-design/ant-design-mobile/blob/master/index.web.js#L10 这一行才是引用js,就会导致 type.tsx 被打包进去

@paranoidjk
Copy link
Contributor

今天也和 @warmhug 讨论过了,一种方案是把 https://github.com/ant-design/ant-design-mobile/blob/master/index.web.js#L10 js的加载也改成和style一样用 require.context去遍历加载

@himStone
Copy link
Author

哦哦我知道了

我这边原来是打算加一个index.web.tsx

index.web.js里

require('./components/index.web');

你们觉得哪个方案好呢,require.context代码量更少?以后加组件也不需要去改动

@paranoidjk
Copy link
Contributor

我赞成 require.context 的方案,但要注意有些 component 是 index.web.tsx, 有些就直接是 index.tsx, 比如 picker, 因为是 web & native 统一代码的

@himStone
Copy link
Author

@paranoidjk 额,如果有区别的话,这正则比较难写

要不这个版本用index.web.tsx的方案,等2.0,#1235 这个后缀名改完后,用require.context的方案

@paranoidjk
Copy link
Contributor

这个我来处理下吧,看下目前不引起 break chang 的方案是什么

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

Successfully merging this pull request may close these issues.

List和Flex的type.d.ts会导致TS2604错误
4 participants