Я пытаюсь использовать угловой Cli 1.7.4 + угловой 5.2.10 + unitegallery 1.7.28, поэтому я использую в main.ts:
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import './provider-plugin';
import 'bootstrap';
import 'unitegallery/dist/js/unitegallery.js';
import 'unitegallery/dist/themes/tiles/ug-theme-tiles.js';
//
import { AppModule } from './app/app.module';
...
provider-plugin.ts (без него unitegallery.js отчетов jQuery отсутствует):
/*!
ProvidePlugin
*/
import * as $ from 'jquery';
window['$'] = $;
window['jQuery'] = $;
window['jquery'] = $;
В браузере я вижу vendor.bundle.js с правильным порядком для unitegallery.js и ug-theme-tile.js , но когда страница загружается я получаю эти ошибки:
jQuery.Deferred exception: g_ugFunctions is not defined ReferenceError: g_ugFunctions is not defined
at HTMLDocument.eval (webpack-internal:///./node_modules/unitegallery/dist/themes/tiles/ug-theme-tiles.js:5:36)
at mightThrow (webpack-internal:///./node_modules/jquery/dist/jquery.js:3534:29)
at process (webpack-internal:///./node_modules/jquery/dist/jquery.js:3602:12)
at ZoneDelegate.invokeTask (webpack-internal:///./node_modules/zone.js/dist/zone.js:421:31)
at Zone.runTask (webpack-internal:///./node_modules/zone.js/dist/zone.js:188:47)
at ZoneTask.invokeTask (webpack-internal:///./node_modules/zone.js/dist/zone.js:496:34)
at ZoneTask.invoke (webpack-internal:///./node_modules/zone.js/dist/zone.js:485:48)
at timer (webpack-internal:///./node_modules/zone.js/dist/zone.js:2054:29) undefined
jQuery.Deferred.exceptionHook @ jquery.js:3818
process @ jquery.js:3606
ZoneDelegate.invokeTask @ zone.js:421
Zone.runTask @ zone.js:188
ZoneTask.invokeTask @ zone.js:496
ZoneTask.invoke @ zone.js:485
timer @ zone.js:2054
setTimeout (async)
scheduleTask @ zone.js:2075
ZoneDelegate.scheduleTask @ zone.js:407
Zone.scheduleTask @ zone.js:232
Zone.scheduleMacroTask @ zone.js:255
scheduleMacroTaskWithCurrentZone @ zone.js:1114
(anonymous) @ zone.js:2090
proto.(anonymous function) @ zone.js:1394
(anonymous) @ jquery.js:3640
fire @ jquery.js:3268
fireWith @ jquery.js:3398
fire @ jquery.js:3406
fire @ jquery.js:3268
fireWith @ jquery.js:3398
ready @ jquery.js:3878
completed @ jquery.js:3888
ZoneDelegate.invokeTask @ zone.js:421
Zone.runTask @ zone.js:188
ZoneTask.invokeTask @ zone.js:496
invokeTask @ zone.js:1540
globalZoneAwareCallback @ zone.js:1566
zone.js:192 Uncaught ReferenceError: g_ugFunctions is not defined
at HTMLDocument.eval (ug-theme-tiles.js:5)
at mightThrow (jquery.js:3534)
at process (jquery.js:3602)
at ZoneDelegate.invokeTask (zone.js:421)
at Zone.runTask (zone.js:188)
at ZoneTask.invokeTask (zone.js:496)
at ZoneTask.invoke (zone.js:485)
at timer (zone.js:2054)
unitegallery.js содержит объявление:
var g_ugFunctions = new UGFunctions();
так в чем проблема или как ее решить?
EDIT
Прекрасно работает, если просто объединить эти 2 файла jite unitegallery:
// import 'unitegallery/dist/js/unitegallery.js';
// import 'unitegallery/dist/themes/tiles/ug-theme-tiles.js';
import 'unitegallery/dist/themes/tiles/unitegallery+ug-theme-tiles.js';