Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RxJS root directory Not Found by SystemJS

SystemJS appears to load rxjs modules without an issue but throws a 404 Not Found on the rxjs directory itself. All modules are the latest version and this only appears to be an issue on Windows, it works on osx.

GET http://localhost:8080/node_modules/rxjs/ 404 (Not Found)

Error: Error: XHR error (404 Not Found) XHR finished loading: GET " localhost:8080/node_modules/rxjs/Subject.js".

XHR finished loading: GET "localhost:8080/node_modules/rxjs/operator/toPromise.js".

Module loads & Error

<script>
    System.config({
        packages: {
            app: {
                format: 'register',
                defaultExtension: 'js',

            },
            'components':{ format: 'register' },
            'rxjs': {defaultExtension: 'js'}
        },
        map: {'app': '/components',
            'rxjs': '../node_modules/rxjs',
            },


    });
    System.import('components/notes.js')
            .then(null, console.error.bind(console));
</script>
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- [email protected]
`-- [email protected]
  `-- [email protected]

I fixed this, it seems the way I was importing rxjs in my .ts was deprecated:

changed from

import {Subject, Observable} from 'rxjs';

to:

import { Observable } from 'rxjs/Observable'; import { Subject } from 'rxjs/Subject'; import { map } from 'rxjs/operator/map';

like image 363
user2040800 Avatar asked Mar 10 '16 05:03

user2040800


1 Answers

You shouldn't add rxjs special things in your system config. SystemJs supports node_modules module lookups by default.

like image 161
basarat Avatar answered Sep 19 '22 14:09

basarat