<!-- Consider supporting the project! https://opencollective.com/terser --> **Bug report or Feature request?** Bug report <!-- Note: sub-optimal but correct code is NOT a bug. --> **Version (complete output of `terser -V` or specific git commit)** 8.0.0 **Complete CLI command or `minify()` options used** I don't know <!-- Note: if you used the node API directly, you're expected to enable the source-map-support module such that your stack traces make sense. --> **`terser` input** ``` window.someGlobalData = { oneFunc: function() { console.log(JSON.stringify(this.data)); } }; (() => { let data = { d: 1 }; data = ({ f: window.someGlobalData.oneFunc, data: data }).f(); })(); ``` <!-- Complete valid ECMAScript code exhibiting the issue with `terser` ALONE - without third party tools or libraries. This means no webpack, rollup, browserify or parcel, among others. Ideally the input should be as small as possible. Code must be in text form - not a screen cap. Post a link to a gist if necessary. Issues without a reproducible test case will be closed. --> **`terser` output or error** ``` window.someGlobalData={oneFunc:function(){console.log(JSON.stringify(this.data))}},(()=>{let o={d:1};o=window.someGlobalData.oneFunc()})(); ``` format: ``` window.someGlobalData = { oneFunc: function() { console.log(JSON.stringify(this.data)) } }, (() => { let o = { d: 1 }; o = window.someGlobalData.oneFunc() })(); ``` **Expected result** ``` window.someGlobalData = { oneFunc: function() { console.log(JSON.stringify(this.data)) } }, (() => { let o = { d: 1 }; o = ({f:window.someGlobalData.oneFunc(),data:o}).f(); })(); ``` `window.someGlobalData.oneFunc` uses the this.data variable, but the this.data environment is removed by mistake after compression webpack issue:https://github.com/webpack/webpack/issues/14455
Activity