<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Require.js in Extension: Unable to add external js library in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670927#M12235</link>
    <description>&lt;P&gt;Cool, thanks a lot &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2020 13:58:32 GMT</pubDate>
    <dc:creator>savandriy</dc:creator>
    <dc:date>2020-01-30T13:58:32Z</dc:date>
    <item>
      <title>Require.js in Extension: Unable to add external js library</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670139#M12214</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello Qlik Community,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm trying to load a library called&amp;nbsp;&lt;A href="https://github.com/mistic100/jQuery-QueryBuilder" target="_blank" rel="noopener"&gt;jQuery-QueryBuilder&lt;/A&gt;, which is a jQuery plugin. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It has three main dependencies:&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- &lt;A href="https://jquery.com/" rel="nofollow" target="_blank"&gt;jQuery 3&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;nbsp;&lt;A href="https://olado.github.io/doT" rel="nofollow" target="_blank"&gt;doT.js&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;nbsp;&lt;A href="https://github.com/mistic100/jQuery.extendext" target="_blank"&gt;Query.extendext&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I downloaded the respective files of the libraries, except jQuery, since it's already pre-installed with Qlik Sense Desktop.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The file structure (the extension is called "test"):&lt;/P&gt;&lt;P&gt;Documents\Qlik\Sense\Extensions\test:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;libs:&lt;UL&gt;&lt;LI&gt;doT.js&lt;/LI&gt;&lt;LI&gt;jquery-extendext.js&lt;/LI&gt;&lt;LI&gt;query-builder.js&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;test.js&lt;/LI&gt;&lt;LI&gt;test.qext&lt;/LI&gt;&lt;LI&gt;wbfolder.wbl&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;test.js:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;define( [ 
	'qlik',
	'jquery',
	'./libs/doT',
	'./libs/jquery-extendext',
	'./libs/query-builder'
],

function (qlik, $, doT, extendext, builder) {

	return {
		support : {
			snapshot: true,
			export: true,
			exportData : false
		},
		paint: function ($element) {
			// some paint code...

                        //needed for export
			return qlik.Promise.resolve();
		}
	};
} );&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But when trying to load them, I get some strange behavior. Using the Network tab in Chrome Developer Tools, I noticed that the files for 'doT' and 'jquery-extendext' are loaded twice. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The requests that succeeded&amp;nbsp;had urls like &lt;STRONG&gt;'&lt;A href="http://localhost:4848/extensions/test/libs/doT.js" target="_blank"&gt;http://localhost:4848/extensions/test/libs/doT.js&lt;/A&gt;'&lt;/STRONG&gt;, where the ones that failed had urls like &lt;STRONG&gt;'&lt;A href="http://localhost:4848/sense/dot/doT.js" target="_blank"&gt;http://localhost:4848/sense/dot/doT.js&lt;/A&gt;'&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I get errors in the console, saying:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Uncaught SyntaxError: Unexpected token '&amp;lt;'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And the files that failed contain HTML, and not js (looks like a blank Qlik page):&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!doctype html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&amp;gt;
    &amp;lt;title&amp;gt;Qlik Sense&amp;lt;/title&amp;gt;
    &amp;lt;meta charset="utf-8"&amp;gt;
    &amp;lt;meta name="HandheldFriendly" content="True"&amp;gt;
    &amp;lt;meta name="MobileOptimized" content="320"&amp;gt;
    &amp;lt;meta name="viewport"
          content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui"&amp;gt;
    &amp;lt;meta name="apple-mobile-web-app-capable" content="yes"&amp;gt;
    &amp;lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&amp;gt;
    &amp;lt;meta name="format-detection" content="telephone=no"&amp;gt;
    &amp;lt;meta http-equiv="cleartype" content="on"&amp;gt;
    &amp;lt;base href="./"&amp;gt;
    &amp;lt;link id="favicon" rel="shortcut icon" href="../resources/favicon.ico"&amp;gt;
    &amp;lt;link rel="apple-touch-icon" href="../resources/img/core/logo/Sense_120x120.png"&amp;gt;
    &amp;lt;link rel="apple-touch-icon" sizes="152x152" href="../resources/img/core/logo/Sense_152x152.png"&amp;gt;
    &amp;lt;link rel="apple-touch-icon" sizes="167x167" href="../resources/img/core/logo/Sense_167x167.png"&amp;gt;
    &amp;lt;link rel="apple-touch-icon" sizes="180x180" href="../resources/img/core/logo/Sense_180x180.png"&amp;gt;
    &amp;lt;link href="../resources/app.6.212.5.css" rel="stylesheet"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body role="application" class="qv-client"&amp;gt;
&amp;lt;div class="qv-preload-icons" style="opacity: 0"&amp;gt;.&amp;lt;/div&amp;gt;
&amp;lt;div class="qv-preload-font" style="opacity: 0"&amp;gt;.&amp;lt;/div&amp;gt;
&amp;lt;div id="qv-init-ui-blocker"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div id="qv-page-container" class="qv-panel-wrap"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div id="addDataConnectorDialogContainer"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div id="dialogContainer"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;script id="__set_assets_path"&amp;gt;window.__DO_NOT_USE__ASSETS_URL = '../resources/';&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="../resources/chunks/angular.da907af5a58359953a44.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="../resources/chunks/angular-lui.0db6f948f3f284cdce58.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="../resources/chunks/axios.11e425123b77dcc47ca7.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="../resources/chunks/es6-promise.a91da5fc9200aee58765.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="../resources/chunks/regenerator-runtime.8d8919a04c37e88f800f.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="../resources/chunks/jquery.0062d05e630bec82a23b.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="../resources/app.6.212.5.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Experimenting, I figured out that the files that succeeded were the ones I manually defined in the 'define' section. The ones that failed, were internal dependencies of the 'query-builder' library:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;/*!
 * jQuery QueryBuilder 2.5.2
 * Copyright 2014-2018 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
 * Licensed under MIT (https://opensource.org/licenses/MIT)
 */
(function(root, factory) {
    if (typeof define == 'function' &amp;amp;&amp;amp; define.amd) {
        define(['jquery', 'dot/doT', 'jquery-extendext'], factory);
    }
    else if (typeof module === 'object' &amp;amp;&amp;amp; module.exports) {
        module.exports = factory(require('jquery'), require('dot/doT'), require('jquery-extendext'));
    }
    else {
        factory(root.jQuery, root.doT);
    }
}(this, function($, doT) {
"use strict";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried multiple configuration options, using stuff like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;requirejs.config({
    paths:{
        "doT": "extensions/test/libs/doT",
		"jquery-extendext": 'extensions/test/libs/jquery-extendext'
    },
});

define( [ 
	'qlik',
	'jquery',
	'doT',
	'jquery-extendext',
	'./libs/query-builder'
],&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this breaks the succesful requests, generating urls like '&lt;STRONG&gt;&lt;A href="http://localhost:4848/sense/extensions/test/libs/doT.js" target="_blank"&gt;http://localhost:4848/sense/extensions/test/libs/doT.js&lt;/A&gt;&lt;/STRONG&gt;'. And this didn't affect the internal dependencies at all &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone please point me to a working config? &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:26:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670139#M12214</guid>
      <dc:creator>savandriy</dc:creator>
      <dc:date>2024-11-16T03:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js in Extension: Unable to add external js library</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670315#M12218</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/70178"&gt;@savandriy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It's weird, an environment issue maybe - but it looks like a bug (please file one) - what version of Qlik Sense Desktop are you using?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 07:54:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670315#M12218</guid>
      <dc:creator>Aiham_Azmeh</dc:creator>
      <dc:date>2020-01-29T07:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js in Extension: Unable to add external js library</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670336#M12220</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/45449"&gt;@Aiham_Azmeh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I'm using the currently latest Qlik Sense Desktop&amp;nbsp;&lt;SPAN&gt;November 2019.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the meantime, I would really like to start developing the extension. Do you think it's possible to use Webpack or some other tools to load the dependencies? Or maybe it's easier to try an older version of Qlik?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 08:53:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670336#M12220</guid>
      <dc:creator>savandriy</dc:creator>
      <dc:date>2020-01-29T08:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js in Extension: Unable to add external js library</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670378#M12225</link>
      <description>&lt;P&gt;Ok, I've tried installing Qlik Sense Desktop&amp;nbsp;&lt;SPAN&gt;June 2019, and it didn't change anything.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 10:51:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670378#M12225</guid>
      <dc:creator>savandriy</dc:creator>
      <dc:date>2020-01-29T10:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js in Extension: Unable to add external js library</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670401#M12227</link>
      <description>&lt;P&gt;Please file a bug.&lt;/P&gt;
&lt;P&gt;A possible workaround&amp;nbsp; could be to use the full path:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;define( [ 
  'qlik',
  'jquery',
  '//localhost:4848/extensions/test/libs/doT',
  '//localhost:4848/extensions/test/libs/jquery-extendext',
  '//localhost:4848/extensions/test/libs/query-builder'
],&lt;/LI-CODE&gt;
&lt;P&gt;Note: this is a theory, I haven't tested it.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 11:34:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670401#M12227</guid>
      <dc:creator>Aiham_Azmeh</dc:creator>
      <dc:date>2020-01-29T11:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js in Extension: Unable to add external js library</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670497#M12229</link>
      <description>&lt;P&gt;I think I've found a way around! And I might've figured what was the issue!&lt;/P&gt;&lt;P&gt;Looking for potential requirejs issues, I stumbled upon a post on &lt;A href="https://stackoverflow.com/questions/28399014/require-js-looking-in-the-wrong-path-for-the-nested-dependencies" target="_self"&gt;stackoverflow&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;In short, requirejs was looking for the nested dependencies in the wrong place.&lt;/P&gt;&lt;P&gt;I couldn't find a way to use relative path though, so I used CDN links. This is my working config:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;requirejs.config({
  packages: [
    { name: 'dot', location: '//cdnjs.cloudflare.com/ajax/libs/dot/1.1.1', main: 'doT' },
	{ name: 'jquery-extendext', location: '//cdn.jsdelivr.net/npm/jquery-extendext@1.0.0', main: 'jquery-extendext' },
	{ name: 'query-builder', location: '//cdn.jsdelivr.net/npm/jQuery-QueryBuilder@2.5.2/dist/js', main: 'query-builder.min' },
  ]
});

define( [ 
	'qlik',
	'jquery',
  	'dot',
  	'jquery-extendext',
  	'query-builder'
],&lt;/LI-CODE&gt;&lt;P&gt;It also works, if you specify the full path from localhost, as you suggested.&lt;/P&gt;&lt;P&gt;The only thing that worries me is if I'll be able to deploy this extension to the server.&lt;/P&gt;&lt;P&gt;Do you know if CDN links are allowed on the server version of Qlik?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 14:06:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670497#M12229</guid>
      <dc:creator>savandriy</dc:creator>
      <dc:date>2020-01-29T14:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js in Extension: Unable to add external js library</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670832#M12234</link>
      <description>&lt;P&gt;Yes, you can use CDN's - but be aware that it may make your extension "un-printable" (&lt;A href="https://help.qlik.com/en-US/sense-developer/September2019/Subsystems/Extensions/Content/Sense_Extensions/Howtos/extensions-enable-export.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/September2019/Subsystems/Extensions/Content/Sense_Extensions/Howtos/extensions-enable-export.htm&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 11:19:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670832#M12234</guid>
      <dc:creator>Aiham_Azmeh</dc:creator>
      <dc:date>2020-01-30T11:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js in Extension: Unable to add external js library</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670927#M12235</link>
      <description>&lt;P&gt;Cool, thanks a lot &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 13:58:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-in-Extension-Unable-to-add-external-js-library/m-p/1670927#M12235</guid>
      <dc:creator>savandriy</dc:creator>
      <dc:date>2020-01-30T13:58:32Z</dc:date>
    </item>
  </channel>
</rss>

