Require.js and Dojo conflict - javascript

I have a mobile application which is written with requirejs, backbone, and jQuery.
It has suddenly come to my attention that a new third part library is required for our map technology.
This map technology is built using Dojo which comes shipped with requirejs baked in.
Is there any simple way to run them both in parallel without conflicts?
Edit: The third party script is using a prebuilt version of application bundled with Dojo 1.9. I can not inject my application code into this as their built version has had the config injection stripped out.

It will not work with a prebuilt version of dojo. You need the source version : see Using requirejs with dojo 1.9.1. This might help as well : http://geonet.esri.com/thread/102952

Related

How can I force old, compiled jquery plugins to use a specific version of jQuery in WordPress?

I have a client who had a very complex jQuery app custom built by a previous developer within his WordPress site. Its functionality is cleanly broken out into several scripts which get minified together with the libraries they depend on. The libraries rely on an old version of jQuery (3.3.1). The site is complex and we need to be able to use the current version of jQuery to allow other plugins we're using to continue to keep up with upgrades.
The libraries include c. 2018 versions of:
Select2
Isotope
SpriteSpin
EasyResponsiveTabs
ImagesUploaded
jQuery Viewport
Some of these are minified/uglified.
I've used best practices to load jQuery 3.3.1 into a variable jQuery3_3_1 with noconflict();
It's rather easy to change standard jQuery to use jQuery3_3_1. But I need a way to force the libraries to use jQuery3_3_1, otherwise they are not recognized by the scripts (and some of them will have issues using a different version of jQuery than they were built in). Most of these use requireJs(), and I've seen instructions for setting up requirejs.config() code in the footer that will define "jquery" to be a particular version. Doing this would be a great solution, but I have no idea how to get these uglified scripts to use it.
I've read through several similar inquiries, but none have addressed forcing a jQuery version on minified/uglified code. Others speak to a level of expertise in jQuery module development that I don't have and don't have time to scale into.
Is there a way to get all these modules that use require('jquery') to have that reference jQuery3_3_1? I'd love it if there were a way to say, "For all the files that live in this directory, jQuery/jquery (there are 2 ways it is called) means jQuery3_3_1/jquery3.3.1".
Or being that it's a Wordpress site, could this be defined in the wp_enqueue_script() call?
Many thanks for your help!

Work with Old Typescript Widgets library in Jhipster

I am trying to get old version of external Typescript/javascript widget library in Jhipster version 6.10+ & 7.0 beta.[This issue will also hit non Jhipster apps in Latest Angular and React Apps] Example Libraries include DHTMLX, bryntum Gantt etc. Unfortunately both libraries only support Angular 2 (old version of typescript standard). Trying to integrate these widget results into lot of typescript errors in these library and hence i have hit a roadblock. Few workaround/hacks that I am thinking
Make Use of standard HTML/javascript way and embed the html as iframe inside Jhipster app.
Use themeleaf to render standard HTML/javascript or JSP page that embed these Widgets
Does anyone has a better alternative? Also suggest what changes that I will need to make in webpack to implement one of the above workaround
DHTMLX Gantt should work in Angular 9 and 10. Here are the demos:
Angular 10
Angular 9

Can I use YUI Compressor or other tool to combine arbitrary javascript files?

My problem is that I need to combine approximately 200 dojo javascript files. Dojo uses the AMD define/require module system. The dojo built-in tools which use Google Closure and Shrinksafe won't work due to a version mismatch (tool is from 1.11.3 source is 1.11.1).
The dojo build includes steps which reference an AST so I'm assuming that you can't just throw any old code at a "combiner". Presumably global variables and other naming conflicts would be the first problem.
Are the tools generally clever enough to handle any old javascript?
The dojo build tools was specifically designed to build dojo application. You won't be able to easily build using YUI or others (like require.js)
You should be able to build from 1.11.3 even if your code is 1.11.1.

How to use both older version and latest version of jquery in a website along with third party plugins?

I am working on an application where the jquery library(currently refrenced ver is 1.4.4) was never updated and the application is very big with lot of usage of jquery spread accross different pages.
I cannot upgrade the jquery library to latest version as this will break the entire website.
Now I have a problem to use third party plugins like datatable, bootstrap js, etc.
I know we can use jquery.noConflict() and give an alias to the latest jquery library and start using that.
But I am not sure if the third party plugins will also work as I think they all are using $ in their code and if I use the above solution my $ will be pointing to older version of the jquery file.
Please help me with your suggestions in this scenario.
Thanks in advance.

Using multiple versions of RequireJS

I have a web app built with Dojo 1.7.2, using RequireJS to load individual modules with AMD. I'd like to add a slightly customized copy of the ACE code editor version 0.2.0, which is about 9 months old and uses an earlier, incompatible version of RequireJS to load itself.
Really I'd just like to include the different JavaScript files (Dojo and ACE) without having a namespace collision (on global functions declare and require which is something that RequireJS is designed to help prevent anyway). I'd like to do this without further customization of either project. Is that even possible to do?
Ace's authors recommend using the newest version from the master branch which should be compatible with recent RequireJS.
BTW, could you post somewhere how you managed to run Dojo 1.7.2 with RequireJS?

Categories

Resources