typescript 不用import?

如果你想用ts文件,而又不想import,export,怎么办呢?

感谢开发者提供的工具. https://github.com/domchen/typescript-plus.

感想: 仅仅有工具是不够的.还得对tsconfig有所了解.不废话,先上重点吧.

module如果采用 commonjs的话,是不能用outFile的.

须采用"amd"模式.

步骤:

1:安装工具 npm install -g typescript-plus,

2:修改tsconfig.json.

{

"compilerOptions": {

"module": "amd",

"accessorOptimization": true,

"emitReflection": true,

"reorderFiles": true,

"defines": { "DEBUG": false, "RELEASE": true },

"outFile":"./bin/js/bundle.js"

},

"exclude": [

"node_modules"

],

"include": [

"src/**/*"

]

}

3:编译 tsc-plus