moment-holiday icon indicating copy to clipboard operation
moment-holiday copied to clipboard

minification (?) causes error in gulp build process

Open bjhewitt opened this issue 7 years ago • 3 comments

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?

bjhewitt avatar Sep 25 '17 16:09 bjhewitt

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

heinst avatar Apr 23 '18 20:04 heinst

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)

martinmurciego avatar Feb 18 '19 16:02 martinmurciego

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.

desi avatar Dec 09 '19 23:12 desi