<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Liferay AMD loader doesn't work with JS fast load</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=82931483" />
  <subtitle>Liferay AMD loader doesn't work with JS fast load</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=82931483</id>
  <updated>2026-04-04T13:39:38Z</updated>
  <dc:date>2026-04-04T13:39:38Z</dc:date>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113861491" />
    <author>
      <name>Ahmed Hasnaoui</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113861491</id>
    <updated>2019-06-03T09:23:41Z</updated>
    <published>2019-06-03T09:23:41Z</published>
    <summary type="html">&amp;lt;p&amp;gt;we have the same issue, did you find any solution?&amp;lt;/p&amp;gt;</summary>
    <dc:creator>Ahmed Hasnaoui</dc:creator>
    <dc:date>2019-06-03T09:23:41Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110902134" />
    <author>
      <name>Chema Balsas</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110902134</id>
    <updated>2018-09-07T09:05:49Z</updated>
    <published>2018-09-07T09:05:49Z</published>
    <summary type="html">&lt;p&gt;Hey Julio, you shouldn't really need this. Please, read the [Using
  External Libraries](&lt;a
  href="https://dev.liferay.com/en/develop/tutorials/-/knowledge_base/7-0/using-external-libraries#using-libraries-that-you-host)"&gt;https://dev.liferay.com/en/develop/tutorials/-/knowledge_base/7-0/using-external-libraries#using-libraries-that-you-host)&lt;/a&gt; documentation
  and try unchecking the expose &lt;strong&gt;global option&lt;/strong&gt; of the
  Liferay Loader in the Configuration Settings.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Hope that helps!&lt;/p&gt;</summary>
    <dc:creator>Chema Balsas</dc:creator>
    <dc:date>2018-09-07T09:05:49Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110901702" />
    <author>
      <name>julio Marquez</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110901702</id>
    <updated>2018-09-07T08:15:44Z</updated>
    <published>2018-09-07T08:15:44Z</published>
    <summary type="html">&lt;p&gt;Hi alessandro, could you please post your config.js and main .js
  files? I am having the same problem.thanks a lot&lt;/p&gt;</summary>
    <dc:creator>julio Marquez</dc:creator>
    <dc:date>2018-09-07T08:15:44Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110354151" />
    <author>
      <name>Pradeep Jain</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110354151</id>
    <updated>2018-06-27T10:38:22Z</updated>
    <published>2018-06-27T10:38:22Z</published>
    <summary type="html">&lt;p&gt;Hi Chema&lt;/p&gt;
&lt;p&gt;We are using a jquery based third party library for carousel OWL
  Carousel. We want to load this  external javascript plugin as a
  Liferay Javascript Module. Actually we dont want to load this external
  javascirpt file on every page so we want to create a module for this
  external javascript file so we can load this where we want.&lt;/p&gt;
&lt;p&gt;We are using this approach.&lt;/p&gt;
&lt;p&gt;1. A file created in JS folder in theme. It is config.js&lt;/p&gt;
&lt;p&gt;2. Calling add module in this config.js like this way.&lt;/p&gt;
&lt;p&gt;        Liferay.Loader.addModule(&lt;br /&gt;             {&lt;br /&gt;       
           dependencies: [],&lt;br /&gt;                 exports:
  'owlcarousel',&lt;br /&gt;                 name: 'owlcarousel',&lt;br /&gt;       
           path: MODULE_PATH + '/js/owl.carousel.min.js'&lt;br /&gt;       
       }&lt;br /&gt;         );&lt;br /&gt;         &lt;br /&gt; 3. Now config.js called
  in liferay plugin package properties file of theme like this way&lt;/p&gt;
&lt;p&gt;Liferay-JS-Config: /js/config.js&lt;/p&gt;
&lt;p&gt;4. For calling this owl carousel we are using code in a display style
  JSP file like this way.&lt;/p&gt;
&lt;p&gt;        &amp;lt;script&amp;gt;&lt;br /&gt;           
   Liferay.Loader.require('owlcarousel', function (moduleName) {&lt;br /&gt;
                  console.log('loading module')&lt;br /&gt;           
   });&lt;br /&gt;         &amp;lt;/script&amp;gt;&lt;br /&gt;         &lt;br /&gt; After
  deploying both module (theme and portlet), we are getting this error
  message in console.&lt;/p&gt;
&lt;p&gt;Liferay AMD Loader: Unhandled failure: Error: Load timeout for
  modules: owlcarousel&lt;br /&gt;  &lt;/p&gt;
&lt;p&gt;Can you suggest what I am doing wrong.&lt;/p&gt;</summary>
    <dc:creator>Pradeep Jain</dc:creator>
    <dc:date>2018-06-27T10:38:22Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=107548990" />
    <author>
      <name>Pradeep Jain</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=107548990</id>
    <updated>2018-04-30T05:41:02Z</updated>
    <published>2018-04-30T05:41:02Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hey Chema&lt;br&gt;&lt;br&gt;I added Loader.addModule(..) in config.js of theme.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
Liferay.Loader.addModule( {
		dependencies: [],
		exports: 'owlcarousel',
		name: 'owlcarousel',
		anonymous: true,
		path: '/o/philadelphia-theme/js/owl.carousel.min.js'
});
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;And I call this module in a JSP of display style using require.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
require(['owlcarousel'], function(owlcarousel) {
   console.log(owlcarousel);
 }, function(error) {
   console.error(error);
});
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;But still I am getting Load timeout error 	       		    			    	&lt;br&gt;Error: Load timeout for modules: owlcarousel&lt;br&gt;&lt;br&gt;So please suggest what is wrong with this code.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Pradeep Jain</dc:creator>
    <dc:date>2018-04-30T05:41:02Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=89042161" />
    <author>
      <name>Ineke Vermeulen</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=89042161</id>
    <updated>2017-05-04T08:00:18Z</updated>
    <published>2017-05-04T08:00:18Z</published>
    <summary type="html">Alessandro, can you please post the main.js and config.js that worked for you? I am getting the same error, so that would really help :-)</summary>
    <dc:creator>Ineke Vermeulen</dc:creator>
    <dc:date>2017-05-04T08:00:18Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82981638" />
    <author>
      <name>Alessandro Candini</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82981638</id>
    <updated>2016-11-30T09:59:09Z</updated>
    <published>2016-11-30T09:59:09Z</published>
    <summary type="html">You&amp;#39;re right again Chema: if I move the Loader.addModule() of require.js inside my config.js, leaving the require of that module inside main.js, It works: I don&amp;#39;t know why it didn&amp;#39;t worked yesterday, maybe a combination of factors related to the &amp;#34;anonymous&amp;#34; thing.&lt;br /&gt;&lt;br /&gt;Regarding the loader feature request, &lt;a href="https://github.com/liferay/liferay-amd-loader/issues/94"&gt;issue opened&lt;/a&gt;!</summary>
    <dc:creator>Alessandro Candini</dc:creator>
    <dc:date>2016-11-30T09:59:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82975091" />
    <author>
      <name>Chema Balsas</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82975091</id>
    <updated>2016-11-30T08:54:40Z</updated>
    <published>2016-11-30T08:54:40Z</published>
    <summary type="html">Hey Alessandro, glad it helped!&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-family: Courier New"&gt;config.js&lt;/span&gt; approach should work. You should only need to do &lt;span style="font-family: Courier New"&gt;Loader.addModule(...)&lt;/span&gt; in there and defer the actual &lt;span style="font-family: Courier New"&gt;require&lt;/span&gt; to wherever you need it into the code. Can you share something more about the issue you experienced? &lt;br /&gt;&lt;br /&gt;About the second question, we don&amp;#39;t have that feature right now. The &lt;a href="https://github.com/liferay/liferay-amd-loader/blob/master/src/js/script-loader.js#L606-L608"&gt;loader simply creates a script element with the module uri&lt;/a&gt;. Might be simple enough to either add this to the loader or create some extension point where this could be done. Would you care opening an issue in the &lt;a href="https://github.com/liferay/liferay-amd-loader/issues"&gt;loader&amp;#39;s GitHub project&lt;/a&gt; so we can start a conversation about it?&lt;br /&gt;&lt;br /&gt;Thanks!</summary>
    <dc:creator>Chema Balsas</dc:creator>
    <dc:date>2016-11-30T08:54:40Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82943205" />
    <author>
      <name>Alessandro Candini</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82943205</id>
    <updated>2016-11-29T14:15:46Z</updated>
    <published>2016-11-29T14:15:46Z</published>
    <summary type="html">By the way: is there a way to tell &lt;strong&gt;Senna.js&lt;/strong&gt; to mark as &lt;strong&gt;data-senna-track=&amp;#34;permanent&amp;#34;&lt;/strong&gt; the module loaded through the Loader?</summary>
    <dc:creator>Alessandro Candini</dc:creator>
    <dc:date>2016-11-29T14:15:46Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82942808" />
    <author>
      <name>Alessandro Candini</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82942808</id>
    <updated>2016-11-29T13:24:59Z</updated>
    <published>2016-11-29T13:24:59Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Yes, the anonymous trick worked!&lt;br&gt;Now I load the module this way, inside &lt;strong&gt;main.js&lt;/strong&gt;:&lt;br&gt;&lt;pre&gt;&lt;code&gt;jQuery(document).ready(function(){
  'use strict';

  Loader.addModule({
    name        : 'enquire',
    dependencies: [],
    anonymous   : true,
    path        : 'my-plugins/enquire/dist/enquire.min'
  });

  require(['enquire', 'my-modules/utils'],
    function(enquire, utils) {
      console.log(enquire);
      console.log(utils);
    },
    function(error) {
      console.error(error);
    }
  ); // require()
}); // jQuery(document).ready()&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;I've tried to load enquire inside &lt;strong&gt;config.js&lt;/strong&gt;, but it doesn't work because the liferay AMD loader itself is loaded &lt;strong&gt;after&lt;/strong&gt; the inclusion of config.js and so the Loader.addModule() API is not available yet...&lt;br&gt;&lt;br&gt;Thanks a lot!&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Alessandro Candini</dc:creator>
    <dc:date>2016-11-29T13:24:59Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82933672" />
    <author>
      <name>Chema Balsas</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82933672</id>
    <updated>2016-11-29T10:38:59Z</updated>
    <published>2016-11-29T10:38:59Z</published>
    <summary type="html">Hey Alessandro,&lt;br /&gt;&lt;br /&gt;You&amp;#39;re using an anonymous amd module and trying to load it via comboloader. This is not supported and that&amp;#39;s why the loader is complaining. You should be able to do one of two things:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If you&amp;#39;re hosting the plugin, modify the &lt;span style="font-family: Courier New"&gt;define(...)&lt;/span&gt; clause to name the module, like &lt;span style="font-family: Courier New"&gt;define(&amp;#39;enquire&amp;#39;, ...)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Add the enquire plugin configuration stating that anonymous=true&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Also, since you&amp;#39;re using the &lt;span style="font-family: Courier New"&gt;config.js&lt;/span&gt; file, it should be easier for you to use the imperative &lt;span style="font-family: Courier New"&gt;Liferay.Loader.addModule() API&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Please, let me know if some of those help.</summary>
    <dc:creator>Chema Balsas</dc:creator>
    <dc:date>2016-11-29T10:38:59Z</dc:date>
  </entry>
  <entry>
    <title>Liferay AMD loader doesn't work with JS fast load</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82931482" />
    <author>
      <name>Alessandro Candini</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=82931482</id>
    <updated>2016-11-29T08:58:05Z</updated>
    <published>2016-11-29T08:58:05Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;I have a Liferay 7 theme which loads 2 AMD modules: an &lt;a href="http://wicky.nillia.ms/enquire.js/"&gt;external plugin&lt;/a&gt; exposed as AMD module and a custom utils module developed by me.&lt;br&gt;With the following properties set into &lt;strong&gt;LIFERAY_HOME/portal-ext.properties&lt;/strong&gt;, module loading works as expected:&lt;br&gt;&lt;pre&gt;&lt;code&gt;minifier.enabled=false
theme.css.fast.load=false
theme.css.fast.load.check.request.parameter=true
theme.images.fast.load=false
theme.images.fast.load.check.request.parameter=true
javascript.fast.load=false
javascript.log.enabled=false
layout.template.cache.enabled=false&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;But my problem comes out when I comment out these properties to get a faster enviroment: &lt;u&gt;module loading does not work anymore&lt;/u&gt;, and Chrome Developer Tools gives me the following messages:&lt;br&gt;&lt;pre&gt;&lt;code&gt;
Mismatched anonymous define() module: function (){return e[f]=g(h)}
http://localhost:8080/o/frontend-js-web/everything.jsp?browserId=other&amp;amp;amp;themeId=mytheme_WAR_mytheme&amp;amp;amp;colorSchemeId=01&amp;amp;amp;minifierType=js&amp;amp;amp;minifierBundleId=javascript.everything.files&amp;amp;amp;languageId=it_IT&amp;amp;amp;b=7010&amp;amp;amp;t=1479460836041

Error: Load timeout for modules: my-plugins/enquire/dist/enquire.min,my-modules/utils&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;Am I missing something? Why it does not load my modules like in the developer version?&lt;br&gt;&lt;br&gt;Below, I'm posting my full configuration and files in order to be as descriptive as possible:&lt;br&gt;&lt;br&gt;&lt;strong&gt;LIFERAY_WORKSPACE/themes/my-theme/src/WEB-INF/liferay-plugin-package.properties:&lt;/strong&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;resources-importer-developer-mode-enabled=true
licenses=LGPL
Liferay-JS-Config=/config/config.js
liferay-versions=7.0.0+
long-description=
module-group-id=liferay
module-incremental-version=1
name=my-theme
Provide-Capability=osgi.webresource;osgi.webresource=my-theme&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;strong&gt;LIFERAY_WORKSPACE/themes/my-theme/src/config/config.js:&lt;/strong&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;// Custom config variable to store modules and not override __CONFIG__
var __CUSTOM_CONFIG__ = {};

// MODULE_PATH is supplied adding the Provide-Capability
// property inside liferay-plugin-package.properties
__CONFIG__.paths['my-plugins'] = MODULE_PATH + '/components';
__CONFIG__.paths['my-modules'] = MODULE_PATH + '/js/modules';

__CUSTOM_CONFIG__.modules = {
    "my-modules/utils": {
        "dependencies": [],
        "path": "my-modules/utils.js"
    }
};&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;strong&gt;LIFERAY_WORKSPACE/themes/my-theme/src/js/modules/utils.js:&lt;/strong&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;define('my-modules/utils', [], function() {
  return {
    // my functions...
  };
});&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;strong&gt;LIFERAY_WORKSPACE/themes/my-theme/src/js/main.js:&lt;/strong&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;jQuery(document).ready(function(){
  'use strict';

  require(['my-plugins/enquire/dist/enquire.min', 'my-modules/utils'],
    function(enquire, utils) {
      console.log(enquire);
      console.log(utils);
    },
    function(error) {
      console.error(error);
    }
  ); // require()
}); // jQuery(document).ready()&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;Any suggestion will be really appreciated, thanks!&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Alessandro Candini</dc:creator>
    <dc:date>2016-11-29T08:58:05Z</dc:date>
  </entry>
</feed>
