app/code/Vendor/Module/view/frontend/requirejs-config.js
var config = {
 map: {
 '*': {
 'gworks/jquery':'Vendor_Module/js/jquery.min' 
 },
 }
};
In template file, I called like
<script type="text/javascript">
require(['gworks/jquery'],function($) {
 $(window).load(function () {
 alert('load from external jquery');
 });
});
</script>
In browser net tab above added js loaded [200 ok]
http://domainame/pub/static/frontend/Vendor/theme/en_US/Vendor_Module/js/jquery.min.js
but it still throw error in browser console like TypeError: $ is not a function and alert also does not come.
I am not familiar in requirejs so I doubted myself anything am I missing here?
- 
 please let me know if you have any issueRakesh Jesadiya– Rakesh Jesadiya2016年11月09日 12:03:34 +00:00Commented Nov 9, 2016 at 12:03
1 Answer 1
Keep below syntax in requirejs-config.js file
 var config = {
 paths: { 
 'gworks/jquery':"Vendor_Module/js/jquery.min" ,
 }, 
 shim: {
 'gworks/jquery': {
 deps: ['jquery']
 },
 }
 };
In script,
<script type="text/javascript">
require(['jquery','gworks/jquery'],function($) {
 $(window).load(function () {
 alert('load from external jquery');
 });
});
</script>
- 
 Remove var and check in frontendRakesh Jesadiya– Rakesh Jesadiya2016年11月09日 11:48:28 +00:00Commented Nov 9, 2016 at 11:48
- 
 thanks @Rakesh still it throws$ is not a functionBilal Usean– Bilal Usean2016年11月09日 12:03:39 +00:00Commented Nov 9, 2016 at 12:03
- 
 you can just deploy run command, remove var folder and clear browser cacheRakesh Jesadiya– Rakesh Jesadiya2016年11月09日 12:10:22 +00:00Commented Nov 9, 2016 at 12:10
- 
 yes I have done clear redis cache, remove var/*, static content deploy, clear browser cache.Bilal Usean– Bilal Usean2016年11月09日 12:11:47 +00:00Commented Nov 9, 2016 at 12:11
- 
 i have update answer, you have missing jquery in script in template, require(['jquery','gworks/jquery']Rakesh Jesadiya– Rakesh Jesadiya2016年11月09日 12:14:46 +00:00Commented Nov 9, 2016 at 12:14
Explore related questions
See similar questions with these tags.