我使用typescript將我的應用程序捆綁到單個.js文件中。據我瞭解,自TS 1.8(我使用2.1)以來這是可能的。這裏是我的.tsconfigTypescript - 將單個輸出中的所有源文件與來自node_modules的所需外部模塊捆綁在一起
{
"compileOnSave": true,
"compilerOptions": {
"experimentalDecorators": true,
"alwaysStrict": true,
"jsx": "react",
"noEmitOnError": true,
"outFile": "dist/bundle.js",
"moduleResolution": "node",
"preserveConstEnums": true,
"removeComments": true,
"sourceMap": true,
"target": "es5",
"module": "system"
},
"exclude": [
"node_modules",
"wwwroot"
]
}
這確實創造了bundle.js文件,但來自node_modules引用的模塊沒有在這個包。是否有可能以某種方式在模塊中添加模塊?
我知道,這可以使用的WebPack或類似的工具來完成,但我的問題是,是否有可能做到這一點只用打字稿