Typescript file exporting interfaces comes up 404 using JSPM

323 views Asked by At

I'm using Typescript 1.5. I started using jspm.

I have a few files that just consist of interface exports. In my tsconfig the module is set to 'system'.

It seems to not like files that are just exporting interfaces. It's giving me 404 errors, looking for them in the dist/app folder when they are located in subfolders underneath it. Only seems to happen in files are just interfaces.

I have the JS files for the interfaces, they are in the correct subfolder. I'm not sure why JSPM is looking for those files in the base url and not the sub folder. I can't find anything that would indicate why. It only seems to be interface files. I do notice that it does this for my interfaces. ```

use strict';System.register([], function(exports_1) { [code....]

```, not sure if that's related. I like having interface files named ISearch.ts and don't want to stick all the interfaces in 1 file either. Some of my interfaces import from others.

Here is a sample interface file. ```

'use strict';
import {ICustomer} from 'customer/ICustomer';
export interface ITransaction {
    items: Array<ILineItem>;
    customer: ICustomer;
    globalDiscount:IDiscount;
    globalTax:ITax;
}

```

errors:

GET http://localhost:9238/app/ITransaction.js 404 (Not Found)f @ es6-module-loader.src.js:2612$__Object$defineProperty.value @ es6-module-loader.src.js:2787c @ es6-module-loader.src.js:377b @ es6-module-loader.src.js:365$__Object$defineProperty.value @ es6-module-loader.src.js:2786$__global.upgradeSystemLoader.e.fetch @ system.src.js:739$__global.upgradeSystemLoader.e.fetch @ system.src.js:1806$__global.upgradeSystemLoader.e.fetch @ system.src.js:1921(anonymous function) @ es6-module-loader.src.js:1525O @ es6-module-loader.src.js:1183K @ es6-module-loader.src.js:11427.y.when @ es6-module-loader.src.js:9307.v.run @ es6-module-loader.src.js:8213.a._drain @ es6-module-loader.src.js:973.a.drain @ es6-module-loader.src.js:62b @ es6-module-loader.src.js:268 es6-module-loader.src.js:2612 GET http://localhost:9238/app/ICalculateTransaction.js 404 (Not Found)f @ es6-module-loader.src.js:2612$__Object$defineProperty.value @ es6-module-loader.src.js:2787c @ es6-module-loader.src.js:377b @ es6-module-loader.src.js:365$__Object$defineProperty.value @ es6-module-loader.src.js:2786$__global.upgradeSystemLoader.e.fetch @ system.src.js:739$__global.upgradeSystemLoader.e.fetch @ system.src.js:1806$__global.upgradeSystemLoader.e.fetch @ system.src.js:1921(anonymous function) @ es6-module-loader.src.js:1525O @ es6-module-loader.src.js:1183K @ es6-module-loader.src.js:11427.y.when @ es6-module-loader.src.js:9307.v.run @ es6-module-loader.src.js:8213.a._drain @ es6-module-loader.src.js:973.a.drain @ es6-module-loader.src.js:62b @ es6-module-loader.src.js:268 es6-module-loader.src.js:2612 GET http://localhost:9238/app/ITenderButton.js 404 (Not Found)f @ es6-module-loader.src.js:2612$__Object$defineProperty.value @ es6-module-loader.src.js:2787c @ es6-module-loader.src.js:377b @ es6-module-loader.src.js:365$__Object$defineProperty.value @ es6-module-loader.src.js:2786$__global.upgradeSystemLoader.e.fetch @ system.src.js:739$__global.upgradeSystemLoader.e.fetch @ system.src.js:1806$__global.upgradeSystemLoader.e.fetch @ system.src.js:1921(anonymous function) @ es6-module-loader.src.js:1525O @ es6-module-loader.src.js:1183K @ es6-module-loader.src.js:11427.y.when @ es6-module-loader.src.js:9307.v.run @ es6-module-loader.src.js:8213.a._drain @ es6-module-loader.src.js:973.a.drain @ es6-module-loader.src.js:62b @ es6-module-loader.src.js:268 es6-module-loader.src.js:2612 GET http://localhost:9238/app/nav-actions/all.js 404 (Not Found)f @ es6-module-loader.src.js:2612$__Object$defineProperty.value @ es6-module-loader.src.js:2787c @ es6-module-loader.src.js:377b @ es6-module-loader.src.js:365$__Object$defineProperty.value @ es6-module-loader.src.js:2786$__global.upgradeSystemLoader.e.fetch @ system.src.js:739$__global.upgradeSystemLoader.e.fetch @ system.src.js:1806$__global.upgradeSystemLoader.e.fetch @ system.src.js:1921(anonymous function) @ es6-module-loader.src.js:1525O @ es6-module-loader.src.js:1183K @ es6-module-loader.src.js:11427.y.when @ es6-module-loader.src.js:9307.v.run @ es6-module-loader.src.js:8213.a._drain @ es6-module-loader.src.js:973.a.drain @ es6-module-loader.src.js:62b @ es6-module-loader.src.js:268 es6-module-loader.src.js:2612 GET http://localhost:9238/app/ISideNavSection.js 404 (Not Found)f @ es6-module-loader.src.js:2612$__Object$defineProperty.value @ es6-module-loader.src.js:2787c @ es6-module-loader.src.js:377b @ es6-module-loader.src.js:365$__Object$defineProperty.value @ es6-module-loader.src.js:2786$__global.upgradeSystemLoader.e.fetch @ system.src.js:739$__global.upgradeSystemLoader.e.fetch @ system.src.js:1806$__global.upgradeSystemLoader.e.fetch @ system.src.js:1921(anonymous function) @ es6-module-loader.src.js:1525O @ es6-module-loader.src.js:1183K @ es6-module-loader.src.js:11427.y.when @ es6-module-loader.src.js:9307.v.run @ es6-module-loader.src.js:8213.a._drain @ es6-module-loader.src.js:973.a.drain @ es6-module-loader.src.js:62b @ es6-module-loader.src.js:268 es6-module-loader.src.js:2612 GET http://localhost:9238/app/ISearch.js 404 (Not Found)f @ es6-module-loader.src.js:2612$__Object$defineProperty.value @ es6-module-loader.src.js:2787c @ es6-module-loader.src.js:377b @ es6-module-loader.src.js:365$__Object$defineProperty.value @ es6-module-loader.src.js:2786$__global.upgradeSystemLoader.e.fetch @ system.src.js:739$__global.upgradeSystemLoader.e.fetch @ system.src.js:1806$__global.upgradeSystemLoader.e.fetch @ system.src.js:1921(anonymous function) @ es6-module-loader.src.js:1525O @ es6-module-loader.src.js:1183K @ es6-module-loader.src.js:11427.y.when @ es6-module-loader.src.js:9307.v.run @ es6-module-loader.src.js:8213.a._drain @ es6-module-loader.src.js:973.a.drain @ es6-module-loader.src.js:62b @ es6-module-loader.src.js:268 es6-module-loader.src.js:2612 GET http://localhost:9238/app/INavAction.js 404 (Not Found)f @ es6-module-loader.src.js:2612$__Object$defineProperty.value @ es6-module-loader.src.js:2787c @ es6-module-loader.src.js:377b @ es6-module-loader.src.js:365$__Object$defineProperty.value @ es6-module-loader.src.js:2786$__global.upgradeSystemLoader.e.fetch @ system.src.js:739$__global.upgradeSystemLoader.e.fetch @ system.src.js:1806$__global.upgradeSystemLoader.e.fetch @ system.src.js:1921(anonymous function) @ es6-module-loader.src.js:1525O @ es6-module-loader.src.js:1183K @ es6-module-loader.src.js:11427.y.when @ es6-module-loader.src.js:9307.v.run @ es6-module-loader.src.js:8213.a._drain @ es6-module-loader.src.js:973.a.drain @ es6-module-loader.src.js:62b @ es6-module-loader.src.js:268 es6-module-loader.src.js:140 Potentially unhandled rejection [3] Error loading "ITransaction" at http://localhost:9238/app/ITransaction.js Error loading "ITransaction" from "boot" at http://localhost:9238/app/boot.js Not Found: http://localhost:9238/app/ITransaction.js (WARNING: non-Error used)

1

There are 1 answers

2
basarat On BEST ANSWER

from 'customer/ICustomer'

For typescript you need to use the complete relative path e.g. ./customer/ICustomer. There is discussion to remove this limitation : https://github.com/Microsoft/TypeScript/issues/2338