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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM