diff --git a/packages/terser/src/index.js b/packages/terser/src/index.js index 26cba157ff..f17fb8bfcc 100644 --- a/packages/terser/src/index.js +++ b/packages/terser/src/index.js @@ -110,7 +110,7 @@ function terserDirectory(input, output, residual, terserBinary) { } fs.readdirSync(input).forEach(f => { - if (f.endsWith('.js')) { + if (path.extname(f) === '.js' || path.extname(f) === '.mjs') { const inputFile = path.join(input, path.basename(f)); const outputFile = path.join(output, path.basename(f));