[英]Tsconfig Build:Argument for '--lib' option must be: 'es5'
Attempting to build an angular 7 application in visual studio and receiving an exception regarding the tsconfig.json lib version. 试图在visual studio中构建一个角度7应用程序并接收有关tsconfig.json lib版本的异常。
Below is the current tsconfig.json 下面是当前的tsconfig.json
{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "module": "es2015", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2018", "dom" ] } }
Build Error 构建错误
Severity Code Description Project File Line Suppression State Error Build:Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string' DocumentLibraryWeb C:\\Users\\Tim\\Source\\Repos\\project-sparkle\\Athena\\DocumentLibraryWeb\\tsc
Severity Code Description Project File Line Suppression State Error Build:Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string' DocumentLibraryWeb C:\\Users\\Tim\\Source\\Repos\\project-sparkle\\Athena\\DocumentLibraryWeb\\tsc
es2018
is not mentioned in this list. 此列表中未提及
es2018
。 It is however a valid option in current TypeScript. 但它是当前TypeScript中的有效选项。
TypeScript version being used by visual studio is clearly the wrong version. Visual Studio使用的TypeScript版本显然是错误的版本。
Quickest fix, guaranteed to work, would be to do a vs reinstall / project reinitialisation. 最快的修复,保证工作,将是重新安装/项目重新初始化。
I managed to get this to compile by disabling the visual studio typescript compiler. 我设法通过禁用visual studio typescript编译器来编译它。 To disable using the following:
要禁用使用以下内容:
Add the property true to a PropertyGroup in your csproj file (I added it under the Configuration label). 将属性true添加到csproj文件中的PropertyGroup(我在Configuration标签下添加了它)。 This should disable all msbuild based TS compilation.
这应该禁用所有基于msbuild的TS编译。
With this setting enabled you shouldn't need the tsconfig.json settings compileOnSave/buildOnSave. 启用此设置后,您不需要tsconfig.json设置compileOnSave / buildOnSave。
If you are on an older version of Visual Studio (I had implicitly thought about VS 2017 or xproj with 2015), the property may be false. 如果您使用的是较旧版本的Visual Studio(我曾暗中考虑过VS 2017或xproj与2015),则该属性可能为false。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.