Skip to content

cjs-override

See the source

Overrides the source type to "commonjs" for .cjs files. Use this when your project is primarily ESM but has some CommonJS files.

Sets languageOptions.sourceType to "commonjs" for files matching the pattern.

["**/*.cjs"]
uglify({
with: ["cjs-override"],
options: {
"cjs-override": {
files: ["**/*.cjs", "legacy/**/*.js"],
},
},
})