SolvedSemantic UI [build] gulp build command not working

gulp build can't complete the 'build-assets' phase due to the following error:

GulpUglifyError: unable to minify JavaScript
Caused by: DefaultsError: `preserveComments` is not a supported option
semantic/tasks/config/tasks.js:96
          if(error.filename.match(/theme.less/)) {
                           ^
TypeError: Cannot read property 'match' of undefined

And is NOT fixed by commenting the following lines:

./tasks/config/tasks.js:148:      preserveComments : 'some'
./tasks/config/tasks.js:162:      preserveComments : false

Steps to reproduce it:

npm install semantic-ui --save
cd semantic/
gulp build
42 Answers

✔️Accepted Answer

Hi, I found that Uglify plugin changed its options and now preserveComments is obsolete:

https://github.com/gruntjs/grunt-contrib-uglify#deprecated-options-from-2x

Option           | Replacement
preserveComments | output.comments

So, just replacing in these 2 lines in semantic/tasks/config/tasks.js:

./tasks/config/tasks.js:148:      preserveComments : 'some'
./tasks/config/tasks.js:162:      preserveComments : false

with:

output: {
    comments: 'some'
}

output: {
    comments: false
}

worked for me.

Other Answers:

I think I found the problem. This issue ... terinjokes/gulp-uglify#265 ... and the latest gulp-uglify release notes reveal that release v3.0.0 of gulp-uglify REMOVED the custom option preserveComments :)

I'll fix the dependencies so that we dont use this version of uglify. Sorry about this guys.

@cluxter dont worry, I'm releasing this later tonight. Continuing to jam on issues. Manual fix above should work in interim.

Will get fix in over weekend. Thanks for patience.

More Issues: