Rich-Harris / butternut

The fast, future-friendly minifier
https://butternut.now.sh
MIT License
1.17k stars 17 forks source link

Bug: "Error: Cannot split a chunk that has already been edited" #140

Open loilo opened 7 years ago

loilo commented 7 years ago

Trying to squash the minified Ext JS source throws an error.

Error: Cannot split a chunk that has already been edited (21:87489 – "){}else")
    at MagicString$1._splitChunk (/path/to/project/node_modules/magic-string/dist/magic-string.cjs.js:919:10)
    at MagicString$1._split (/path/to/project/node_modules/magic-string/dist/magic-string.cjs.js:908:51)
    at MagicString$1.appendLeft (/path/to/project/node_modules/magic-string/dist/magic-string.cjs.js:459:8)
    at Node.minify (/path/to/project/node_modules/butternut/dist/butternut.cjs.js:3651:12)
    at Node.minify (/path/to/project/node_modules/butternut/dist/butternut.cjs.js:1469:14)
    at Node.minify (/path/to/project/node_modules/butternut/dist/butternut.cjs.js:1555:37)
    at Node.minify (/path/to/project/node_modules/butternut/dist/butternut.cjs.js:3645:15)
    at Node.minify (/path/to/project/node_modules/butternut/dist/butternut.cjs.js:2052:19)
    at Node.minify (/path/to/project/node_modules/butternut/dist/butternut.cjs.js:3645:15)
    at Node.minify (/path/to/project/node_modules/butternut/dist/butternut.cjs.js:240:11)
nifgraup commented 7 years ago

triggered by

if ( any_condition_1 )
    if ( !any_condition_2 )
        {}
    else
        any_fn_2()
pilishen commented 6 years ago

still facing this problem in 0.4.6 release

 node_modules/axios/lib/helpers/spread.js{ Error: Error transforming bundle with 'butternut' plugin: Cannot split a chunk that has already been edited (29716:8 – " {
      /*jshint noempty:false*/
    } while (")

it's axios this time

BTW, hope u can sync the release on rollup-plugin-butternut, thanks