languageOptions
Configures the ECMAScript version and module source type for your project.
Defaults
Section titled “Defaults”| Option | Default |
|---|---|
ecmaVersion | "latest" |
sourceType | "module" |
Options
Section titled “Options”uglify({ with: ["languageOptions"], options: { languageOptions: { ecmaVersion: 2022, sourceType: "module", additionalGlobals: { myGlobal: "readonly", }, }, },})ecmaVersion
Section titled “ecmaVersion”The ECMAScript version to parse. Default: "latest".
sourceType
Section titled “sourceType”Either "module" (ESM) or "commonjs". Default: "module".
additionalGlobals
Section titled “additionalGlobals”An object of additional global variables to define. Keys are variable names, values are "readonly" or "writable".