简体   繁体   English

启动 Angular 11 项目时出现 tsconfig 错误

[英]tsconfig error when start Angular 11 project

I just create a project didn't do any changes.我只是创建一个项目没有做任何更改。 It shows error in tsconfig.json file.它在tsconfig.json文件中显示错误。 I tried to fix this by changing the es2020 into es2015 but it did not fix the error我试图通过将es2020更改为es2015来解决此问题,但它没有解决错误

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

Here is my tsconfig.json这是我的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
}
}

How can I solve this.我该如何解决这个问题。

update your tsconfig.app.json file as well with "module": "es2015"使用"module": "es2015"更新您的tsconfig.app.json文件

I think the problem is that Angular needs :我认为问题在于Angular 需要

"module": "amd",

While Lit needs one of the ES module variants.而 Lit 需要 ES 模块变体之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM