Angular2 invalid runtime import path

I have an angular2 application, and at runtime it tries to load a resource from the wrong URL.

He should look for him at: http: // localhost: 54675 / app / services / angular2-jwt.js , but he will look for him: http: // localhost: 54675 / app / general / services / angular2 -jwt.js. A common word should not be in the way.

I have this structure in angular2:

app
---services
------angular2-jwt.ts
---shared
------country
---------country.service.ts

In country.service.ts, I refer to angular2 -jwt.ts as follows:

import {AuthHttp} from '../../services/angular2-jwt';

As you can see, these are two (in the application) and down to services. It should indicate this path: app / services / angular2 -jwt. I look in compiled js with the right look:

System.register(['angular2/core', '../../services/angular2-jwt']

Visual Studio intelliSense. AuthHttp . . , .

broswer:

Error: Unable to load script: http://localhost:54675/app/shared/services/angular2-jwt.js

, URL- script . "" , .

. js , , . chrome ( ) Firefox ( ), , . ?

SystemJS configuraiton index.html:

<script>
      System.config({
        packages: {
          app: {
            format: 'register',
            defaultExtension: 'js'
          }
        }
      });
      System.import('app/boot')
            .then(null, console.error.bind(console));
    </script>

. , ( "../../services/ angular2-jwt" ) - .

+4
1

, . , .

+1

Source: https://habr.com/ru/post/1628174/


All Articles