简体   繁体   中英

tsconfig error when setting module to ES2017

Following documentation for LitElement my tsconfig.json looks like this:

  {   
    "compilerOptions": {
        "target": "ES2017",
        "module": "ES2017",
        "moduleResolution": "node",
        "experimentalDecorators": true
      },
    "include": [
        "src/*"
    ]
}

I see an error saying

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

Can you please try adding the "lib" array to your compiler options as shown below?. Also change all occurences of es from ES to es

  {   
    "compilerOptions": {
        "target": "es2017",
        "module": "es2017",
        "moduleResolution": "node",
        "experimentalDecorators": true,
        "lib": [
                  "es2017",
                  "dom"
                ]
      },
    "include": [
        "src/*"
    ]
}

Hope this helps.

This is a bug in the LitElement docs . There error tells you what's wrong. Typescript module does not support ES2017 as a value. You should change it to es2015 or esnext .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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