[英]Why does Visual studio 2019 adds <TypeScriptCompile Remove /> in my project?
I have an asp.net core 2.2 project running on .net 4.7.2, which includes the Microsoft.TypeScript.MSBuild nuget package. I have an asp.net core 2.2 project running on .net 4.7.2, which includes the Microsoft.TypeScript.MSBuild nuget package.
Every time I add a new typescript (.ts or.tsx) file to my project, visual studio automatically adds a:每次我将新的 typescript(.ts 或 .tsx)文件添加到我的项目时,Visual Studio 都会自动添加:
<ItemGroup><TypeScriptCompile Remove="myFile.ts" /></ItemGroup>
line into my project.csproj file.进入我的 project.csproj 文件。
Here is my tsconfig file:这是我的 tsconfig 文件:
{
"compilerOptions": {
// Target latest version of ECMAScript.
"target": "esnext",
// Search under node_modules for non-relative imports.
"moduleResolution": "node",
// Process & infer types from .js files.
"allowJs": false,
"jsx": "react",
// Don't emit; allow Babel to transform files.
"noEmit": true,
// Enable strictest settings like strictNullChecks & noImplicitAny.
"strict": true,
// Disallow features that require cross-file information for emit.
"isolatedModules": true,
// Import non-ES modules as default imports.
"esModuleInterop": true,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
/* my paths */
}
},
"include": [
/* my typescript folders */
],
"exclude": [ "node_modules" ]
}
Note that I'm only using the package to type-check my files, the actual compilation is done using Babel.请注意,我只使用 package 对我的文件进行类型检查,实际编译是使用 Babel 完成的。
Can you please help me understand why Visual studio adds these TypeScriptCompile Remove in my project?你能帮我理解为什么 Visual Studio 在我的项目中添加这些 TypeScriptCompile Remove 吗? Am I doing something wrong?
难道我做错了什么?
The "remove" entry is added so that you don't get the nested filename.js and filename.js.map files appearing in your project folder structure.添加了“删除”条目,这样您就不会在项目文件夹结构中看到嵌套的 filename.js 和 filename.js.map 文件。 The instruction explicitly tells Visual Studio not to compile this file and instead allows you to use some other compiler (either the TSC that you downloaded via NPM or perhaps even the Angular compiler).
该指令明确告诉 Visual Studio 不要编译此文件,而是允许您使用其他一些编译器(您通过 NPM 下载的 TSC,甚至可能是 Angular 编译器)。 Basically it tells VisualStudio to get out of the way.
基本上它告诉 VisualStudio 让开。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.