Closed dithom closed 3 months ago
Please open this issue in terser
repo - https://github.com/terser/terser, we just a plugin to run this tool, thank you
@alexander-akait Please see section "What I already checked"
Terser CLI with command --compress --mangle --mangle-props -- node_modules/tiny-slider/src/tiny-slider.js
. This does not output the same behavior, which leads me to think the plugin being the issue.
@dithom We don't modify your output at all, check our code, also you use TerserPlugin.swcMinify, it means I point to wrong repo try it here - https://github.com/swc-project/swc
@alexander-akait thanks for the hint! Will try it there.
@dithom Try to comment minify: TerserPlugin.swcMinify
and check again
And check your source code, becuse 150
should be number
in code, not string
Webpack 5.89.0 Plugin version 5.3.10
Bug report
When using the
+=
operator first on a number and then on a string while thecompress
option is active, the output will be concatenated. This leads to unwanted results at runtime.Actual Behavior
For example:
should output
which outputs
150px
at runtime. Instead it outputsSo at runtime the result ist not
150px
but10050px
.I came across this while working with https://github.com/ganlanyuan/tiny-slider, see https://github.com/ganlanyuan/tiny-slider/blob/4d709735c417c2483e77a22d017fc1b18c04f0d4/src/tiny-slider.js#L2606.
Expected Behavior
The output should be:
How Do We Reproduce?
Use the plugin to bundle the TinySlider code, with the following config:
What I already checked:
--compress --mangle --mangle-props -- node_modules/tiny-slider/src/tiny-slider.js
. This does not output the same behavior, which leads me to think the plugin being the issue.Screenshot of the actual issue inside the project: