Message Boards
Liferay AMD Loader in Gradle Theme WAR project
Daniel Yee, modified 3 Years ago.
Liferay AMD Loader in Gradle Theme WAR project
New Member Posts: 2 Join Date: 9/27/19 Recent Posts
References:
I get the following error in the browser's developer console:
Am I missing something in my steps or how IntelliJ is setup? I've tried adding the JS Module Config Generator Gradle plugin and the JSTranspiler plugin, but those return statuses of SKIPPED when running them.
It would be great to get it working automatically to avoid misconfigurations, but if it's something wrong with the plugins not working correctly, then how do I manually configure the modules? I'm confused by Reference 2 in modifying the bnd.bnd file. My theme doesn't have one.
Steps:
- https://help.liferay.com/hc/en-us/articles/360018161951-Liferay-AMD-Module-Loader
- https://help.liferay.com/hc/en-us/articles/360018161911-Configuring-Modules-for-Liferay-DXP-s-Loaders-
I get the following error in the browser's developer console:
Error: The following problems where detected while resolving modules:
· Missing required module 'test'
Am I missing something in my steps or how IntelliJ is setup? I've tried adding the JS Module Config Generator Gradle plugin and the JSTranspiler plugin, but those return statuses of SKIPPED when running them.
It would be great to get it working automatically to avoid misconfigurations, but if it's something wrong with the plugins not working correctly, then how do I manually configure the modules? I'm confused by Reference 2 in modifying the bnd.bnd file. My theme doesn't have one.
Steps:
- Create new file test.es.js located at /wars/myTheme/src/main/js/test/
- In test.es.js, add the AMD define statement:
Liferay.Loader.define('test', function() { 'use strict'; return { hello: function(msg) { [i][b]console[/b][/i].log("Hello " + msg); } }; } );
- In main.js, add the AMD require statement:
Liferay.Loader.require('test', function(test) { test.hello("goodbye"); }, function(error) { [i][b]console[/b][/i].error(error); });
- Deploy
Daniel Yee, modified 3 Years ago.
RE: Liferay AMD Loader in Gradle Theme WAR project (Answer)
New Member Posts: 2 Join Date: 9/27/19 Recent Posts
According to Liferay support, this is expected with liferay-amd-loader version 4.x and later. The documentation is incorrect and are being updated.
The recommended route is to use liferay-npm-bundler which is mandatory for 7.2.
The recommended route is to use liferay-npm-bundler which is mandatory for 7.2.