【问题标题】:tsconfig error when start Angular 11 project启动Angular 11项目时出现tsconfig错误
【发布时间】:2021-07-21 11:40:38
【问题描述】:

我只是创建了一个项目没有做任何更改。它在tsconfig.json 文件中显示错误。我试图通过将es2020 更改为es2015 来解决此问题,但它没有修复错误

TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.

这是我的tsconfig.json

 {
  "compileOnSave": false,
  "compilerOptions": {
  "baseUrl": "./",
  "outDir": "./dist/out-tsc",
  "forceConsistentCasingInFileNames": true,
  "strict": true,
  "strictPropertyInitialization": false,
  "noImplicitReturns": true,
  "noFallthroughCasesInSwitch": true,
  "sourceMap": true,
  "declaration": false,
  "downlevelIteration": true,
  "experimentalDecorators": true,
  "moduleResolution": "node",
  "importHelpers": true,
  "target": "es2015",
  "module": "es2020",
  "lib": [
    "es2018",
    "dom"
  ]
},
 "angularCompilerOptions": {
   "enableI18nLegacyMessageIdFormat": false,
   "strictInjectionParameters": true,
   "strictInputAccessModifiers": true,
   "strictTemplates": true
}
}

我该如何解决这个问题。

【问题讨论】:

  • "module": "es2020" 也应该是"module": "es2015"

标签: javascript typescript tsconfig lit-element angular11


【解决方案1】:

更新您的tsconfig.app.json 文件以及"module": "es2015"

【讨论】:

  • 感谢您的建议,但这并没有解决错误
【解决方案2】:

我认为问题在于Angular needs:

"module": "amd",

虽然 Lit 需要 ES 模块变体之一。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-25
    • 1970-01-01
    • 2020-12-18
    • 2019-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-20
    相关资源
    最近更新 更多