Skip to content

Commit 95fcfa0

Browse files
authored
Allow multiple umd files to load into global.vuei18nLocales (martinlindhe#98)
* Allow multiple umd files to load into global.vuei18nLocales * IE support? * update tests
1 parent f546c3f commit 95fcfa0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ private function getUMDModule($body)
357357
(function (global, factory) {
358358
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
359359
typeof define === 'function' && define.amd ? define(factory) :
360-
(global.vuei18nLocales = factory());
360+
typeof global.vuei18nLocales === 'undefined' ? global.vuei18nLocales = factory() : Object.keys(factory()).forEach(function (key) {global.vuei18nLocales[key] = factory()[key]});
361361
}(this, (function () { 'use strict';
362362
return {$body}
363363
})));

tests/GenerateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function testBasicWithUMDFormat()
211211
'(function (global, factory) {' . PHP_EOL
212212
. ' typeof exports === \'object\' && typeof module !== \'undefined\' ? module.exports = factory() :' . PHP_EOL
213213
. ' typeof define === \'function\' && define.amd ? define(factory) :' . PHP_EOL
214-
. ' (global.vuei18nLocales = factory());' . PHP_EOL
214+
. ' typeof global.vuei18nLocales === \'undefined\' ? global.vuei18nLocales = factory() : Object.keys(factory()).forEach(function (key) {global.vuei18nLocales[key] = factory()[key]});' . PHP_EOL
215215
. '}(this, (function () { \'use strict\';' . PHP_EOL
216216
. ' return {' . PHP_EOL
217217
. ' "en": {' . PHP_EOL

0 commit comments

Comments
 (0)