Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Liferay.Loader.define of undefined
تم تعديل Amos Fong منذ 9 سنوات من الدقائق.
New Member
المشاركات: 22
تاريخ الإنضمام: 29/7/16
المشاركات الحديثة
I'm trying to get started exposing Liferay 7 es2015 modules to other portlets by following this tutorial:
But I'm not able to blade deploy the module without removing the the module.config.generator dependency on line 17 of the build.gradle file:
Otherwise, I will get this error in Terminal after trying to blade deploy the module:
So if i remove the generator dep and deploy, then deploy a portlet that requires it with aui in the view.jsp like this:
I get the following error in the browser console:
What am I doing wrong???
https://github.com/liferay/liferay-docs/tree/master/develop/tutorials/code/osgi/modules/js-loggerBut I'm not able to blade deploy the module without removing the the module.config.generator dependency on line 17 of the build.gradle file:
classpath group: "com.liferay", name: "com.liferay.gradle.plugins.js.module.config.generator", version: "1.0.22"Otherwise, I will get this error in Terminal after trying to blade deploy the module:
Error
0. [ExceptionTransformer.transform] org.gradle.tooling.BuildException: Could not fetch model of type 'CustomModel' using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.0-bin.zip'.
So if i remove the generator dep and deploy, then deploy a portlet that requires it with aui in the view.jsp like this:
<aui:script require="js-logger/logger.es">
var Logger = jsLoggerLoggerEs.default;
var loggerOne = new Logger('*** -> ');
loggerOne.log('Hello');
var loggerDefault = new Logger();
loggerDefault.log('World');
</aui:script>
I get the following error in the browser console:
Uncaught TypeError: Cannot read property 'define' of undefined
Which points to Liferay.Loader.define("js-logger@1.0.0/utils/log.es", ["exports"], function (exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (msg) {
document.getElementById("context").innerHTML += msg + ' ';
};
});
//# sourceMappingURL=log.es.js.map
What am I doing wrong???
تم تعديل John Schulz منذ 9 سنوات من الدقائق.
New Member
المشاركات: 22
تاريخ الإنضمام: 29/7/16
المشاركات الحديثة
Please see attached js-logger module and blade.portlet.jsp modules for source code.
Thank you,
John
Thank you,
John
الملحقات:
تم تعديل Severin Rohner منذ 9 سنوات من الدقائق.
RE: Liferay.Loader.define of undefined
(الإجابة)
Junior Member
المشاركات: 43
تاريخ الإنضمام: 28/1/14
المشاركات الحديثة
Hi John
On Friday I faced the same issue. My quick workaround was to add the JavaScript
If you use Liferay Workspace 1.2.0 (file settings.gradle) the transpile code in the build folder starts with
IMHO the Liferay Workspace has implemented new "features" they aren't int Liferay 7 GA3. So hopefully there will be soon the GA4!
On Friday I faced the same issue. My quick workaround was to add the JavaScript
Liferay.Loader = Loader; before I was loading the module. (With Liferay Workspace 1.2.4)If you use Liferay Workspace 1.2.0 (file settings.gradle) the transpile code in the build folder starts with
define("js-logger@, with version 1.2.4 it starts with Liferay.Loader.define("js-logger@IMHO the Liferay Workspace has implemented new "features" they aren't int Liferay 7 GA3. So hopefully there will be soon the GA4!
تم تعديل Chema Balsas منذ 9 سنوات من الدقائق.
Regular Member
المشاركات: 127
تاريخ الإنضمام: 25/2/13
المشاركات الحديثة
Hey John, Severin,
Based on community feedback, we implemented a way to Hide Liferay's AMD Loader. To do this, we now always namespace the previously global require and define methods.
All the generated code points to the namespaced version of those methods so everything works even if the admin decides to hide it from the global scope.
This was backported and will be available as soon as GA4 is released, so in the meantime, you should use an older version of the gradle plugins or some kind of workaround as Severin pointed out.
Sorry for the inconvenience
Based on community feedback, we implemented a way to Hide Liferay's AMD Loader. To do this, we now always namespace the previously global require and define methods.
All the generated code points to the namespaced version of those methods so everything works even if the admin decides to hide it from the global scope.
This was backported and will be available as soon as GA4 is released, so in the meantime, you should use an older version of the gradle plugins or some kind of workaround as Severin pointed out.
Sorry for the inconvenience
تم تعديل John Schulz منذ 9 سنوات من الدقائق.
New Member
المشاركات: 22
تاريخ الإنضمام: 29/7/16
المشاركات الحديثة
Thank you Severin!!!!
Lifesaver! I was honestly stuck. I appreciate the quick response.
Chema, what kind of change will be required when GA4 is released...will we simply call
as documented?
Lifesaver! I was honestly stuck. I appreciate the quick response.
Chema, what kind of change will be required when GA4 is released...will we simply call
Liferay.Loader.define(...)as documented?
تم تعديل Chema Balsas منذ 9 سنوات من الدقائق.
Regular Member
المشاركات: 127
تاريخ الإنضمام: 25/2/13
المشاركات الحديثة
Hey John,
Unless you are manually doing require or define calls, you shouldn't need to change anything. Even then, you wouldn't necessarily need to change those. If you're sure your admins will never hide the Liferay Loader, then the global methods will always be exposed.
Once GA4 is out, you can keep using the new versions of the gradle plugins normally and all the code should work for you.
Unless you are manually doing require or define calls, you shouldn't need to change anything. Even then, you wouldn't necessarily need to change those. If you're sure your admins will never hide the Liferay Loader, then the global methods will always be exposed.
Once GA4 is out, you can keep using the new versions of the gradle plugins normally and all the code should work for you.
تم تعديل John Schulz منذ 9 سنوات من الدقائق.
New Member
المشاركات: 22
تاريخ الإنضمام: 29/7/16
المشاركات الحديثة
Thanks Chema!
Community
Company
Feedback