denoland / dnt

Deno to npm package build tool.
MIT License
1.25k stars 40 forks source link

Feature request: support target ES2022 #269

Closed davecardwell closed 1 year ago

davecardwell commented 1 year ago

I’m targeting Node.js v18 (current LTS) which largely supports ES2022 according to https://node.green/

Thus, I’d like to set compilerOptions.target to ES2022, but that is not in the ScriptTarget union, and results in:

panicked at 'called Result::unwrap() on an Err value: Error("unknown variant ES2022, expected one of ES3, ES5, ES2015, ES2016, ES2017, ES2018, ES2019, ES2020, ES2021, Latest", line: 1, column: 568)', wasm\src\lib.rs:68:56

I can presumably set the target to Latest and get largely the same effect for now, but in case the definition of Latest changes in the future I’d like to pin my target to ES2022.

dsherret commented 1 year ago

I'll do a release later, but for now you can use it (and see if it works) at:

import { build } from "https://raw.githubusercontent.com/denoland/dnt/fbf36c6ad8136a18e6337fc48cd063cb292793e3/mod.ts";

// etc...
davecardwell commented 1 year ago

@dsherret Thank you for the quick turnaround on this! I can confirm that it works 🙌