2

I am trying to use custom theme with JHipster (Metronic theme if does it matter).
I followed the advice how to add css and js https://stackoverflow.com/a/42070788/9026582

But when running npm run webpack:build webpack build does not compile.
I got error like this (there were more similar to the one below, posting only one for simplicity):

ERROR in /home/robert/workspace/robo/src/main/webapp/app/content/layout/aside/aside-left.component.ts
(105,76): Cannot find name 'mUtil'.

I've done some research and find out that probably declaration types file is missing. Found it among the theme and copied to JHipster project. The file looks like that:

/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
    id: string;
}

declare var mMenu: any;
declare var mOffcanvas: any;
declare var mScrollTop: any;
declare var mHeader: any;
declare var mToggle: any;
declare var mQuicksearch: any;
declare var mUtil: any;
declare var mPortlet: any;

Now webpack build compiles, but there are problems when rendering the site.
Styling works fine, but scripts are not correctly loaded and in browser console I can see errors (again omitting similar ones):

HeaderComponent.html:1 ERROR ReferenceError: mUtil is not defined
    at HeaderDirective.ngAfterViewInit (header.directive.ts?6754:56)
    at callProviderLifecycles (core.js?09c9:9568)
    at callElementProvidersLifecycles (core.js?09c9:9542)
    at callLifecycleHooksChildrenFirst (core.js?09c9:9532)
    at checkAndUpdateView (core.js?09c9:10468)
    at callViewAction (core.js?09c9:10700)
    at execComponentViewsAction (core.js?09c9:10642)
    at checkAndUpdateView (core.js?09c9:10465)
    at callViewAction (core.js?09c9:10700)
    at execEmbeddedViewsAction (core.js?09c9:10663)

There is mUtil occurence in theme file scripts.bundle.js, but I import that file in JHipster's vendors.ts.
I've checked what webpack build gives me. Inside main.bundle.js I found mUtil occurence so it should be loaded when rendering the site.

I am looking for any help as I do not have knowledge or idea how to make it work.

rupertoss
  • 63
  • 1
  • 7

0 Answers0