kodie / moment-holiday

A Moment.js plugin for handling holidays. NO LONGER MAINTAINED (DEPRECATED)
MIT License
83 stars 86 forks source link

minification (?) causes error in gulp build process #15

Open bjhewitt opened 7 years ago

bjhewitt commented 7 years ago

I'm having an issue when code is compiled and minified via gulp / browserify / babelify / gulp-uglify

Uncaught TypeError: Cannot read property 'united_states' of undefined, at:

p = function(t) { if (regions = t.split("/"), t = regions[0].toLowerCase().replace(" ", "_"), regions.shift(), !s.holidays[t]) try { var r = "./locale/"; "build" == n.split("/").slice(-1).pop() && (r = "." + r), e(r + t) } catch (s) {} return !!s.holidays[t] && (regions.length ? u(t, regions) : s.holidays[t]) }

in moment-holiday-us.min.js

It works fine with the same build process if I tell browserify not to minify via options, which skips gulp-uglify. Any thoughts on what could be going on?

heinst commented 6 years ago

Im having the same issue...did you ever get it resolved?

martinmurciego commented 5 years ago

This command: gulp --name=moment-holiday-ar.js --locale=Argentina --locale=Easter --set=Argentina --min Cause:

Error: Cannot find module 'yargs' at Function.Module._resolveFilename (module.js:555:15) at Function.Module._load (module.js:482:25) at Module.require (module.js:604:17) at require (internal/module.js:11:18) at Object. (/home/martin/Descargas/moment plugin rangos intervalos y dias habiles/unzipped/moment-holiday-master/gulpfile.js:1:74) at Module._compile (module.js:660:30) at Object.Module._extensions..js (module.js:671:10) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3)

desi commented 4 years ago

This is more of an FYI for you but this also happens when using the uglifier gem inside a rails project. If you tell uglifier not to mangle the variable names it doesn't happen. Hope that is helpful to someone.