Semantic-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

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 41 (8 by maintainers)

Commits related to this issue

Most upvoted comments

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.

I think I found the problem. This issue … https://github.com/terinjokes/gulp-uglify/issues/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.

And out 2.2.13

Yep, can confirm the issue. Commenting out L148 & L162 (temporarily) solves it.

Tried with older version of Node / npm & latest version too. It’s not camelCase related or node version related

A weekend late but pushing this now.

@tarkwyn Can you make a pull request to fix this?

Hi, @jlukic I have installed de last updates (2.2.13) of semantic and tried build the project. The fix worked succefully.

Thanks a lot.