Error:
GET http://localhost:63342/Dog.js 404 (Not Found)
XHR error (404 Not Found) loading http://localhost:63342/Dog.js
<br/><br/>Below is the script in my index.html file. <script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.src.js"></script>
<script>
// set our baseURL reference path
System.config({
baseURL: '.'
});
System.import('Dog.js').catch(console.log.bind(console));
</script>
Animal.ts
export class Animal {
color: string;
age: number;
constructor(color: string, age:number) {
this.color = color;
this.age = age;
}
add(animal: Animal) {
return new Animal(this.color + animal.color, this.age + animal.age);
}
}
Dog.ts
import {Animal} from './Animal';
var animal1 = new Animal("red", 1);
var animal2 = new Animal("yellow", 2);
var animal3 = animal1.add(animal2);
console.log('Combine Two Animals' + animal3);
tsconfig.json
{
"compilerOptions": {
"target": "ES5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": false
},
"exclude": [
"node_modules"
]
}
All the provided files are located within the same directory.