For example, codes in a.js
looks like this
require('b')
$=require('jquery')
$.ready()
And codes in b.js
looks like this
$=jQuery=require('jquery')
$.ready()
If I set a.js
as the entry point, what will happen, as 'jquery' is required twice, will it be loaded twice?
Just like in Node, the module code is only evaluated once. You can try this by putting a console.log
statement in your module.