node-jsmin icon indicating copy to clipboard operation
node-jsmin copied to clipboard

Failing to preserve whitespace in template literals

Open TracyGJG opened this issue 2 years ago • 0 comments

Here is a minimal example using jsmin 1.0.1 from npm:

const token = "String";
const message = `Unexpected ${token} encountered`;

The result of running JSMin:

const token="String";const message=`Unexpected ${token}encountered`;

Observe how the space after the closing curly brace in the template literal has been removed, which changes the value of message.

Environment: MS Windows 11 home, Node Js 18.12.1

I ran the code through JSLint.com without a fault.

TracyGJG avatar Dec 12 '22 06:12 TracyGJG