-
Notifications
You must be signed in to change notification settings - Fork 56
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
chore(dependency): 升级 rxjs 6 #544
base: release
Are you sure you want to change the base?
Conversation
e525fa0
to
63d304a
Compare
@@ -0,0 +1,39 @@ | |||
export { defer } from 'rxjs/internal/observable/defer' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too hack, 直接引用就好了,webpack4 会帮你摇树
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Brooooooklyn 发现这样包反而大了,不知道为什么,我今天有空再看一下。我觉得到最后这些东西肯定是在一个 'rxjs' 上引最舒服,所以想着可以有这么一个 rx 模块把具体来源 rxjs
, rxjs/operators
, rxjs/ajax
这些封装掉。所以提了第二个 commit 做了这样的修改。还没想清楚,这样的形式好不好。你有建议吗?谢谢!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Brooooooklyn 我们还没 webpack4 ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外我觉得我们可以用 esm 了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有用 webpack4 的话可以用 ts-import-plugin 去处理一下,我觉得源码内保持 rxjs 的原始引用方式比较好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Saviio 记得看过 dan 最近对发布 esm 的这串评论:https://twitter.com/dan_abramov/status/1009185305117843456 @~@
在上边提到的,原来打包结果大的原因是,没有配置好 tree shake 机制的情况下,虽然本项目使用了深引用来手动挑出需要的 rxjs 模块,但如果依赖的 reactivedb 用的是需要有匹配的 tree shake 机制才能被缩小的 rxjs@6 推荐引用写法(如: 为了验证这个想法,在 reactivedb 开出一个实验分支,其内也使用深引用来手动挑出需要的 rxjs 模块。并发版 |
并不再在代码里区分 rxjs, rxjs/operators, rxjs/ajax 这样的子模块引用 (除了在 rx 模块中)。
添加的 `import 'rxjs/internal/symbol/observable` 是用来保证在 reactivedb 的 rxjs 依赖完全清瘦的情况下,SymbolConstructor 上的 observable 字段被挂上,令 ts 编译通过。
6687571
to
d9239de
Compare
@@ -0,0 +1,41 @@ | |||
import 'rxjs/internal/symbol/observable' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Brooooooklyn 不知道你有没有看到过需要这句话,引入将 observable
挂在 SymbolConstructor
类型上的副作用,才能让某些操作符或者构造函数编译成功的?我还没追踪,打算再看一下。
不加这句话,我遇到了 Property 'observable' does not exist on type 'SymbolConstructor'
这个报错。
/cc @Saviio
/cc @aicest
TODOs: