javascript - Unable to load module with extention js in TypeScript and Systemjs -


get request systemjs not adding extention .js url.

these typescript classes

customer.ts

import {address} "./address";  export class customer {     private _customername: string = "";     public customeraddress: address = new address();     public set customername(value: string) {         if (value.length == 0) {             throw "customer name required";          }         this._customername = value;     }     public customername() {         return this._customername;     }     validate(): boolean {         return this._customername != '';     } } 

address.ts

export class address {     public street1: string = ""; } 

using following systemjs init code

system.config({       defaultextension: 'js', }); system.import("customer.js").then(function (exports) {       var cust = new exports.customer(); }); 

customer.js loaded address.js not.

the request address.js not contains .js extention resulting following request in console

get http://localhost:65401/address 404 (not found). 

i have tried update following code in customer.ts following

import {address} "./address.js"; 

but syntactically wrong , shows error in vs2013.

how can force systemjs add extension ".js" request.

thanks

the defaultextension keyword not top level config option. needs under packages directive, see: https://github.com/systemjs/systemjs/blob/master/docs/config-api.md#packages

that's why it's ignored , systemjs doesn't append extension. can define 1 "global" package easiest way make sure extension appended every import path:

systemjs.config({   packages: {     '.': {       defaultextension: 'js'     }   } }); 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -