When making a GET request with Systemjs, the extension .js is not being added to the URL.
These are my TypeScript Classes
customer.ts
import {Address} from "./Address";
export class Customer {
private _customerName: string = "";
public CustomerAddress: Address = new Address();
public set CustomerName(value: string) {
if (value.length == 0) {
throw "Customer Name is required";
}
this._customerName = value;
}
public get CustomerName() {
return this._customerName;
}
Validate(): boolean {
return this._customerName != '';
}
}
address.ts
export class Address {
public Street1: string = "";
}
using the following Systemjs initialization code
System.config({
defaultExtension: 'js',
});
System.import("Customer.js").then(function (exports) {
var cust = new exports.Customer();
});
While Customer.js is loaded successfully, Address.js is not found.
The GET request for Address.js does not include the .js extension, resulting in the following error in the console:
GET http://localhost:65401/Address 404 (Not Found).
I have attempted to update the code in customer.ts to the following:
import {Address} from "./Address.js";
However, this syntax is incorrect and results in an error in VS2013.
Is there a way to instruct Systemjs to automatically add the extension ".js" to the GET request?
Thank you