使用ES6功能并以ES5为目标,而无需从仅包含npm的项目开始提供polyfill?

时间:2019-02-06 09:09:13

标签: typescript webpack babel

我有一个简单的TypeScript项目,到目前为止,它仅具有A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) + CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException + FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand + PSComputerName : "MyServerFQDN" ParserError: (:) [Invoke-Sqlcmd], ParserException + CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException + FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand + PSComputerName : "MyserverFQDN" ,没有其他构建工具。还没有npmwebpack

能够使用babel功能并定位ES6而不必考虑提供polyfill的最简单的好方法是什么?

我的印象是ES5和/或babel可能是适合此的工具,但是我发现的大多数指南都假设一个人已经在使用webpackwebpack。我还没有从像我这样的some front-end framework开始就找到好的解决方案。

1 个答案:

答案 0 :(得分:1)

在tsconfig.json中设置目标:“ es5”和lib:[“ es6”]。

Typescript包含es6 / es7功能,如果正确配置tsconfig.json,它将为您转换所有内容