Foros de discusión

Trouble with included vis.js library - ES6 script - Liferay 7.0 GA3

Damien Guillermet, modificado hace 7 años.

Trouble with included vis.js library - ES6 script - Liferay 7.0 GA3

Junior Member Mensajes: 44 Fecha de incorporación: 9/07/15 Mensajes recientes
Hello,

I have included the Vis.js library in a Liferay Faces portlet like outputscript resource example (except that I loaded the vis.min.js file via <header-portlet-javascript> tag in liferay-portlet.xml). Since I upgraded from Liferay 6.2.4 GA6 to 7.0 GA3 I'm not able to use it anymore: a JS error is raised in web browser console (vis is not defined) although the script seems to be loaded.
The Vis.js script is compatible with ES6 module system. I'm not sure if this matter concerns Liferay Faces or how Liferay 7 manages JS resources.

I can provide a sample to reproduce if it's necessary (implementing a vis.js basic usage).

Best regards,
Damien.
thumbnail
Juan Gonzalez, modificado hace 7 años.

RE: Trouble with included vis.js library - ES6 script - Liferay 7.0 GA3

Liferay Legend Mensajes: 3089 Fecha de incorporación: 28/10/08 Mensajes recientes
Hi Damien.

You're basically reproducing a known problems with amd-loader and js files that aren't ready for that.

Please read here: https://web.liferay.com/community/forums/-/message_boards/message/81981433 to know about the possible solution. Create two js files, one to be included before disabling amd loader, then other one for enabling it after your included js file.

More info: http://stackoverflow.com/questions/34269886/amd-loader-disable-enable-in-theme
Damien Guillermet, modificado hace 7 años.

RE: Trouble with included vis.js library - ES6 script - Liferay 7.0 GA3

Junior Member Mensajes: 44 Fecha de incorporación: 9/07/15 Mensajes recientes
Hello Juan and thank you again I'll read that ;)
Sorry for posting this subject in Liferay Faces forum it was not the appropriate location!

EDIT: I followed you advice and it works like a charm.
thumbnail
Chema Balsas, modificado hace 7 años.

RE: Trouble with included vis.js library - ES6 script - Liferay 7.0 GA3

Regular Member Mensajes: 127 Fecha de incorporación: 25/02/13 Mensajes recientes
Hey Damien, just FYI, we've worked on https://issues.liferay.com/browse/LPS-68298 to allow hiding the loader behind a namespace with just a simple system setting.

Once this is merged and gets to your liferay distribution, you should be able to simply configure the loader to be hidden and get rid of the workaround.

Hope that helps!
Damien Guillermet, modificado hace 7 años.

RE: Trouble with included vis.js library - ES6 script - Liferay 7.0 GA3

Junior Member Mensajes: 44 Fecha de incorporación: 9/07/15 Mensajes recientes
Hello Chema,
yes i read that issue thank you for your great work emoticon
I'm impatient to use it in the next Liferay release!
Damien.
thumbnail
Chema Balsas, modificado hace 7 años.

RE: Trouble with included vis.js library - ES6 script - Liferay 7.0 GA3

Regular Member Mensajes: 127 Fecha de incorporación: 25/02/13 Mensajes recientes
Thanks a lot for the kind words and understanding, Damien, and sorry about the current inconveniences this is causing you.

The code for this is finalized and backported, so it shouldn't be long now until it ends up in a FixPack emoticon

Please, let us know if you still have some other issues with this!