Requirejs jquery dependency problem

Requirejs jquery dependency problem

zeliretzeliret Posts: 1Questions: 1Answers: 0
edited October 2014 in Free community support

I have requirejs config:

requirejs.config({
    "baseUrl": "/static/js/lib",
    "paths": {
        // Application
        "app": "../app",

        // Libs
        "backbone": "backbone-min",
        "underscore": "underscore-min",
        "jquery": "jquery-2.1.1.min",
        "datatables": "jquery.dataTables.min",

        // Plugins
        "css": "plugins/css.min"
    },
    "map": {
        "*": {
            // Simple aliases
            "widget": "app/view/widget",
            "page": "app/view/page",

            "model": "app/model"
        }
    }
});

And I noticed that datatables trying to use jquery not from my config.
Firebug network tab shows this url: /static/js/lib/jquery.dataTables.min/js/jquery.js

When I remove module name (datatables) from jquery.dataTables.js It works fine. Datatables starts to use my jquery (/statis/js/lib/jquery-2.1.1.min).

How can I make datatable to use my jquery?

Answers

  • allanallan Posts: 63,386Questions: 1Answers: 10,449 Site admin

    No idea I'm afraid. That looks like it should work to me. It might be best to ask in a RequireJS specific forum, or perhaps StackOverflow, with a link to a test case.

    Internally DataTables refers to jquery as a dependency, which you have mapped, which is why it looks like it should work.

    Would be interested to know what the resolution is if you hear back from someone with more RequireJS knowledge than myself.

    Allan

This discussion has been closed.