使用asp.net mvc和打字稿
我已经创建了10个打字稿文件(a.ts,b.ts .......)
ts配置
{
"compilerOptions": {
"strict": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"sourceMap": false,
"noImplicitAny": true,
"noEmitOnError": true,
"removeComments": false,
"noImplicitUseStrict": false,
"target": "es2017"
},
"compileOnSave": true
}
然后使用mvc bundleconfig
bundles.Add(new ScriptBundle("~/bundles/TypeScripts")
.IncludeDirectory("~/Scripts/TypeScripts", "*.js", true));
之后,将脚本包添加到index.cshtml页面
现在的问题是
此脚本包从TypeScripts文件夹加载了所有js文件,但我只需要加载页面上说的那些文件即可
我正在创建ts类的实例
$(function(){
let ___aInstance = new A();
let ___bInstance = new B();
});
因此仅加载两个文件,而并非全部加载
您能帮我解决这个问题吗?