ExLibrisGroup/primo-explore-devenv

Importing files into custom.js

Closed this issue · 2 comments

Hello,

We are trying to separate the modules of the custom.js file into separate files. We tried importing the files using the import statement (reference: https://github.com/NYULibraries/primo-explore-nyu/blob/master/js/main.js) but it doesn't seem to work for us.
eg: import { configurations } from './modules/trial';
This leads to rendering issues (The logo disappears, for example).

Could it be because of the parameters that we're passing inside the templates (eg: ng-click="showAdvanced($event)")?

Do you have any suggestions or documentation on how to achieve this?

Thank you so much for your time!

Hi @eklee0126,

By default, the gulp build task just concatenates all js files. If you want use ES6-style modules, try adding --browserify to the gulp command. (For example: gulp run --view CENTRAL_PACKAGE --browserify.) If you use the browserify option, be sure to name your main file main.js.

forgot to say thank you for your comment. We resolved the issue thanks to your comment.

Thanks!