From 9e48b41006dc157b289d46fb5cc08f3c370a4bfa Mon Sep 17 00:00:00 2001 From: George Mihailov Date: Sun, 28 Jun 2020 15:19:33 -0700 Subject: [PATCH 1/2] Extend existing moment instance before loading from dependencies In a multi-plugin world `require 'moment'` leads to problems discussed in #102 --- src/twix.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/twix.coffee b/src/twix.coffee index cfe1e2e..84f94d3 100644 --- a/src/twix.coffee +++ b/src/twix.coffee @@ -455,7 +455,7 @@ makeTwix = (moment) -> Twix # -- MAKE AVAILABLE -return module.exports = makeTwix(require 'moment') if hasModule +return module.exports = makeTwix(if moment then return moment else require 'moment') if hasModule if typeof(define) == 'function' && define.amd define 'twix', ['moment'], (moment) -> makeTwix(moment) From 62d05dc63a92af536420338a643d67547c56ca85 Mon Sep 17 00:00:00 2001 From: George Mihailov Date: Fri, 3 Jul 2020 16:05:01 -0700 Subject: [PATCH 2/2] Fix coffescript syntaxis --- src/twix.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/twix.coffee b/src/twix.coffee index 84f94d3..c0d6765 100644 --- a/src/twix.coffee +++ b/src/twix.coffee @@ -455,7 +455,7 @@ makeTwix = (moment) -> Twix # -- MAKE AVAILABLE -return module.exports = makeTwix(if moment then return moment else require 'moment') if hasModule +return module.exports = makeTwix(if moment? then moment else require 'moment') if hasModule if typeof(define) == 'function' && define.amd define 'twix', ['moment'], (moment) -> makeTwix(moment)