在Systemjs中使用TypeScript

文件目录:

root----index.html

       |--main.ts

       |--person.ts

       |--package.json

   

index.html





  
  SystemJS
  
  
  



   main.ts

import {Person} from './person.ts';
 
let person = new Person("chenshixian");
console.log(person.name);

person.ts

import {Person} from './person.ts';
 
let person = new Person("chenshixian");
console.log(person.name);

package.json

{
  "name": "testsystemjs",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "lite-server"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "lite-server": "^2.5.4",
    "systemjs": "^0.19.47",
    "typescript": "^3.8.3"
  }
}

使用npm i 加载包

使用npm run dev启动web服务

你可能感兴趣的:(在Systemjs中使用TypeScript)