1

I have an error when I load datatables js.

Load timeout for modules: datatables

It is possible I have some wrong configuration (path). How can I check where requirejs expects file ? Can I get path from module in requirejs ?

I don't see any fail load file in Chrome console.

"datatables": "DataTables/DataTables-1.10.15/js/jquery.dataTables.min",
"datatables.net": "DataTables/DataTables-1.10.15/js/jquery.dataTables.min",

1 Answer 1

3

If you put two different module names pointing to the same file path in your paths configuration, then that's not going to work: RequireJS will error out.

If you want two module names to resolve to the same file, what you should do is use map to perform the mapping and leave only one module in paths, like:

paths: {
  "datatables.net": "DataTables/DataTables-1.10.15/js/jquery.dataTables.min",
},
map: {
  "*": {
    datatables: "datatables.net",
  },
}

The map setting makes it so that when any module ("*") makes a request for the module named datatables it receives the module named datatables.net instead.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.