Vidhya Mahendran Vidhya Mahendran - 4 months ago 10
Javascript Question

how to include versioned JS files in data-main attribute in require js

I am trying to include JS file with version using require js like below:

<script data-main="main.57302bdda2413911ef49e5d48c63d777.js"

Console Error: require.js:1 Uncaught Error: No define call for

Is there any syntax error here?
How to include the file with 2 dots in data-main attribute?


In the r.js optimizer's build config if you are using a name property, it will use that name to include a module by the same name in your bundled file somewhere like this:

}), define("main", ["app"], function(a) {
    a.on("before:start", function() {}), a.on("start", function(a) {}), a.on("application:ready", function() {

When this bundled file coupled with this define definition is renamed as main.*.js instead of main.js, it throws an error

require.js:1 Uncaught Error: No define call for main.*.js

because it couldn't find that module named define call, because instead it has main.js's define call, as explained. Hope this helps in solving the problem.