Semantic-UI icon indicating copy to clipboard operation
Semantic-UI copied to clipboard

[build] gulp build command not working

Open simoncarbajal opened this issue 9 years ago • 41 comments

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

simoncarbajal avatar May 21 '17 15:05 simoncarbajal

would also like to see this answered as i am having the same issue. ⌛️

fabulousduck avatar Jun 01 '17 14:06 fabulousduck

i tried to resolve this by downloading the semantic zip from the website. although this zip does not contain everything and will still error out giving the following This relative module was not found: *./themes/default/assets/images/loader-large.gif in ./~/css-loader?{"minimize":false,"sourceMap":false}!./semantic/dist/semantic.min.css

fabulousduck avatar Jun 01 '17 14:06 fabulousduck

@simoncarbajal i fixed this by completely removing semantic and reinstalling it. not sure where the cause lies. :man_shrugging:

fabulousduck avatar Jun 01 '17 14:06 fabulousduck

Fix is to change filename to fileName in line 96 of semantic/tasks/config/tasks.js

e.g. if(error.fileName.match(/theme.less/)) {

tarkwyn avatar Jun 22 '17 09:06 tarkwyn

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

j-f1 avatar Jun 22 '17 11:06 j-f1

I can confirm that @tarkwynl 's change worked for me. I can provide additional details if needed.

SamPlusPlus avatar Jul 06 '17 15:07 SamPlusPlus

The camelCase issue didn't cause any problems, however I was unable to successfully gulp build until I commented out the two preserveComments tags in /semantic/tasks/config/tasks.js

The error (with "gulp-uglify": "^3.0.0"):

[13:56:35] Created: dist/components/site.js
[13:56:35] Plumber found unhandled error:
 GulpUglifyError: unable to minify JavaScript
Caused by: DefaultsError: `preserveComments` is not a supported option
File: /Volumes/DATA/WWW/skilled/semantic/dist/components/site.js

designosis avatar Jul 07 '17 18:07 designosis

@neokio I also received the perserveComments error, but I had to upgrade my version of node to the latest, to get pass that.

I will not very experienced with gulp/node so take my inputs with a grain of salt.

SamPlusPlus avatar Jul 07 '17 18:07 SamPlusPlus

Interesting! Good advice in general, so I updated node from 7.7.1 to the latest (8.1.3), and reinstalled npm (npm install -g npm) just to be sure.

The above error still appears, unless I remove both perserveComments.

designosis avatar Jul 07 '17 18:07 designosis

The error persists in 2.2.11 ... unable to successfully gulp build until I removed both preserveComments lines from /semantic/tasks/config/tasks.js.

designosis avatar Jul 11 '17 17:07 designosis

@neokio could be unrelated, but when I said I updated to the latest for Node Js I actually went for LTS, not current. https://nodejs.org/en/ so I went on version 6.11.1

SamPlusPlus avatar Jul 11 '17 17:07 SamPlusPlus

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 :)

designosis avatar Jul 11 '17 18:07 designosis

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

vinayakkulkarni avatar Jul 12 '17 07:07 vinayakkulkarni

After all, what will be done in the semantic ui ? To remove the option or comment and wait for uglify downgrade ?

rafaelgilead avatar Jul 14 '17 23:07 rafaelgilead

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

jlukic avatar Jul 15 '17 00:07 jlukic

I'm a little late to the party, but I figure another confirmation can't hurt. Commenting out L148 & L162 worked for me as well. Thanks!

jpetitte avatar Jul 22 '17 16:07 jpetitte

Commenting out L148 & L162. It worked for me too.

rafaelgilead avatar Jul 22 '17 17:07 rafaelgilead

Commenting out L148 & L162. It worked for me too.

bhargavy avatar Jul 24 '17 06:07 bhargavy

Commenting out only worked , can't find out if issue is in gulp-uglify or semantic ui.

Madankapoor avatar Jul 28 '17 04:07 Madankapoor

Will get fix in over weekend. Thanks for patience.

jlukic avatar Jul 28 '17 14:07 jlukic