-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Description
我在尝试接入RxJS的时候发现几个问题
- 除了有
require('./root')外,还有其他形式:
require('../util/root');
require('../../util/root');可以通过以下命令查看所有引用root的文件
cd node_modules/rxjs
# or
cd dist/npm/rxjs
# find
grep -r "/root" --include \*.js * -
除了util目录下用到root,还有另外一些目录也有。同样可以通过以上命令查出来
-
在prod模式下,貌似require用的是双引号,而不是单引号。所以正则应该考虑下两种情况
module.exports.plugins.replace = {
filter: /rxjs[\\/]util[\\/].*\.js$/,
config: {
find: /require\(['"]\.\/root.js['"]\)/,
replace: '{root:require(\'./../../wepy-async-function/global.js\')}'
}
}- 我想既用moment又用 rxjs,那么replace插件支持同时配置吗?请问如何写?
Environment
- Platform: 开发者工具
- Platform version: 2017.01.16 基础库更新(1.9.0)
- Wechat version: 6.6.1
- wepy-cli version: v1.6.0
- wepy version: 1.6.0
Reproduce
- 启用promise
- 启用rxjs
- 写某些底层带有setInterval的rxjs代码
Observed Results
Possible Unhandled Promise Rejection: TypeError: root_1.root.setInterval is not a function
at AsyncAction.requestAsyncId (AsyncAction.js:65)
at AsyncAction.schedule (AsyncAction.js:60)
at AsyncScheduler.Scheduler.schedule (Scheduler.js:43)
at DelaySubscriber._schedule (delay.js:100)
at DelaySubscriber.scheduleNotification (delay.js:112)
at DelaySubscriber._next (delay.js:116)
at DelaySubscriber.Subscriber.next (Subscriber.js:90)
at ScalarObservable._subscribe (ScalarObservable.js:49)
at ScalarObservable.Observable._trySubscribe (Observable.js:172)
at ScalarObservable.Observable.subscribe (Observable.js:160)Expected Results
正常运行不报错
Relevant Code / Logs
import Rx from 'rxjs/Rx'
var o = Rx.Observable.of(1)
var powersOfTwo = o
.mapTo(1)
.expand(x => Rx.Observable.of(2 * x).delay(1000))
.take(10);
powersOfTwo.subscribe(x => console.log(x));Metadata
Metadata
Assignees
Labels
No labels