jquery - have to list jquery in config path
jquery will not work for me unless I put in in the require config:
require.config({
baseUrl: 'node_modules',
paths: {
app: "../app",
jquery: 'jquery/dist/jquery'
}
}
If I remove it from the require.config, I can see it (and the wrapper file created by adapt-pkg-main) downloading in the network traffic, but for modules using it with a define, like this:
define(['jquery', 'knockout'], function ($, ko) { .... }
$ is undefined. If I put it in the require config, it works.
Awesome library by the way! Thanks
I am having the same issue with "bootstrap-dialog". This library identifies itself as "bootstrap-dialog" for AMD and I think this might cause problems - maybe there is only one key "bootstrap-dialog" for requirejs and the value is overwritten?
(function(root, factory) {
"use strict";
// CommonJS module is defined
if (typeof module !== 'undefined' && module.exports) {
module.exports = factory(require('jquery'), require('bootstrap'));
}
// AMD module is defined
else if (typeof define === "function" && define.amd) {
define("bootstrap-dialog", ["jquery", "bootstrap"], function($) {
return factory($);
});
} else {
// planted over the root!
root.BootstrapDialog = factory(root.jQuery);
}
}(this, function($) {
. . .
I tried stepping through and when execCb fires, when it is using the adapt-pkg-main wrapper (path not defined in require config file), it is calling the callback in your wrapper:
function(m) { return m; }
rather than the callback in the original code to create the object -
this callback is never called
function($) {
return factory($);
});
When I define the path in the require config, it calls the correct callback.
I don't know why this would be different when defining a path in the config file vs not.