Reputation: 13682
Require.js takes an optional config. Is it possible to map a path to an existing variable?
require.config({
"paths": {
"jquery": "../my/path/to/jquery"
}
});
However, there is a case where I don't actually need jquery but a library thinks it does. So I need to include jquery but it doesn't actually use it. Actually storing the jquery file is bloat. So I want to map require("jquery")
to function() {}
. Is there any way to do this?
Upvotes: 0
Views: 152
Reputation: 151401
You don't need to set a paths
for jquery
for what you are trying to do. What you could do is add a fake jQuery module just before your call to require.config
:
define('jquery');
This defines a jquery
module that has an undefined
value. If your premiss that you are using a library that requires jQuery but does not actually use it is true, then this will work.
Upvotes: 1