tsconfig.json 用umd打包方法
头两行可以选择注释掉就是无模块。用umd都可以顺利编译、运行
import { myutil } from "./myutil";
myutil.exportIt();
let now = new Date(Date.now() + 8 * 60 * 60 * 1000);
let time = now.toISOString();
time = time.substring(0, time.length - 5);
time = time.replace("T", " ");
console.log(time);
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "umd",
"lib": [
"dom",
"es2015"
],
"inlineSourceMap": true,
"outDir": "./js",
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "watch一下",
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": [
"$tsc-watch"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/js/index.js"
}
]
}