From 022579a9bfb6ee7f1c03212a5bb061f7c1344c57 Mon Sep 17 00:00:00 2001 From: Jose Fresco Date: Fri, 6 Nov 2015 11:58:51 -0300 Subject: [PATCH 1/2] Explicitly require locales to include them in Browserify build --- index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/index.js b/index.js index 042901c..4de26d7 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,24 @@ var moment = require('moment') , half = 1000 * 30 , o = document.querySelectorAll.bind(document); +require('moment/locale/ca'); +require('moment/locale/de'); +require('moment/locale/el'); +require('moment/locale/es'); +require('moment/locale/fi'); +require('moment/locale/fr'); +require('moment/locale/gl'); +require('moment/locale/hu'); +require('moment/locale/it'); +require('moment/locale/nl'); +require('moment/locale/pl'); +require('moment/locale/pt'); +require('moment/locale/ru'); +require('moment/locale/sq'); +require('moment/locale/sv'); +require('moment/locale/uk'); +require('moment/locale/zh-tw'); + module.exports = Timeago; /** From ae3d03a127ae5e9832a9f82fb9cd0e2163630e64 Mon Sep 17 00:00:00 2001 From: Jose Fresco Date: Fri, 6 Nov 2015 12:15:07 -0300 Subject: [PATCH 2/2] Added explanation comment --- index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4de26d7..4acffa8 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,12 @@ var moment = require('moment') , half = 1000 * 30 , o = document.querySelectorAll.bind(document); +/* + * I have to require explicitly all locales I want to use + * because Browserify only put in its bundle the required modules. + * More here: https://github.com/moment/moment/issues/2007 + */ + require('moment/locale/ca'); require('moment/locale/de'); require('moment/locale/el'); @@ -101,4 +107,4 @@ function toArray (list) { function updateElement (el) { el.innerHTML = moment(el.getAttribute(this.attr)).fromNow(); -} \ No newline at end of file +}