I have a very Typescript app and I want to use rxjs.
I did:
npm install --save-dev rxjs
then in the file main.ts:
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/from';
import 'rxjs/add/operator/filter';
function test() {
Observable.from([0,1,2,3,4])
.filter((x) => x >= 2)
.subscribe((x) => console.log(x));
}
I get a compilation error:
Module not found: Error: Cannot resolve module 'rxjs/add/observable/from'
In case you need: here is my gulpfile, using Webpack
Do you know what I'm missing ? Thank you guys
I was checking your
webpack.config.js
, where you missed to add the resolvable extensions.The webpack says,
Since you are overriding the webpack's default resolve extension options, you have to tell the webpack that, please resolve the modules which has
['.js', '.ts', '']
extensions.