相关疑难解决方法(0)

Angular 4使用ES2017(例如string.prototype.padStart)

我正在使用角度4并使用字符串管道用零填充字符串.但是角度或vs代码会丢失原型"padStart"不存在的错误.

  1. 如何为我的项目和/或编辑器设置此支持?

  2. 如果padStart不存在,如何添加polyfill?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart

typescript angular es2017

6
推荐指数
1
解决办法
3224
查看次数

具有最少文件数的 Angular ng 构建?(仅支持 Chrome 也可以)

当我构建我的 angular 项目时,我看到

main-es5.jsmain-es2015.js 两个文件。我只想支持 Chrome 浏览器如何关闭构建旧的 js 文件我希望 Build.js 上的文件数量最少。

自从我升级到 8 以来,我的 Build 也运行了两次

笔记

构建时间显着增加,我在预算中收到警告警告,初始超出最大值。

这是我的Angular.json文件

      "optimization": true,
      "outputHashing": "none",
      "sourceMap": true,
      "extractCss": false,
      "namedChunks": false,
      "showCircularDependencies": false,
      "aot": true,
      "extractLicenses": false,
      "statsJson": false,
      "progress": true,
      "vendorChunk": false,
      "buildOptimizer": true,
Run Code Online (Sandbox Code Playgroud)

浏览器列表文件

# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please …
Run Code Online (Sandbox Code Playgroud)

angular-cli angular angular8

5
推荐指数
1
解决办法
1747
查看次数

TypeScript TSConfig CompilerOptions ES2017 目标和库

我正在开发一个 TypeScript 项目,我们使用 ES2017 作为输出目标,以及其中一个库,因为它将通过 Babel,我们希望支持任何“Env”的最新功能集我们的目标是 Babel。

一切似乎都很好,所以我不太担心。但是,我不知道幕后发生了什么或“lib”选项真正做了什么(除了告诉我的 IDE 我可以做什么,比如传播操作、承诺等),以及是否更多/指定 TypeScript 的最高输出然后编译到 Babel 中非常特定的目标的效率较低。这也通过 WebPack,所以我们利用了 tree splash 的优势。

第二个问题是,当“ES2017”包含在库中时,是否包含 ES2015 和 ES2016 中的所有功能(换句话说,是否有任何理由将 ES2015 和/或 ES2016 包含在列表中?)

{
  "compilerOptions": {
    "target": "ES2017",
    "module": "ES2015",
    "moduleResolution": "Node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "allowSyntheticDefaultImports": true,
    "noEmitHelpers": true,
    "importHelpers": true,
    "pretty": true,
    "alwaysStrict": true,
    "lib": [
      "DOM",
      "ES2017",
      "DOM.Iterable",
      "ScriptHost"
    ],
    "baseUrl": "./client",
    "paths": {
      "styles/*": ["./app/styles/*"],
      "core/*": ["./app/core/*"],
      "components/*": ["./app/components/*"],
      "containers/*": ["./app/containers/*"],
      "assets/*": ["./assets/*"],
      "config/*": ["./config/*"]
    }
  },
  "files": …
Run Code Online (Sandbox Code Playgroud)

typescript ecmascript-6 tsconfig babeljs ecmascript-2017

3
推荐指数
1
解决办法
7219
查看次数