data-main fetch the file even when is is compiled #65

Open
jfromaniello opened this Issue Aug 30, 2012 · 0 comments

Comments

Projects
None yet
1 participant
@jfromaniello

I have a problem with the data-main attribute, i dont know if it is a problem of requirejs or jam.

the script tag in my html looks like this:

<script src="/jam/require.js" data-main="/main.js" /> 

and the main file as follows:

require(["jquery"], function($){
  $(function(){
     alert("hello")
  });
});

when I run this in the dev environment everything works just fine.

The problem came when I compile this thing by doing:

jam compile -i main.js -o jam/require.js

It seems that in the output file, require.js first will explore and fetch what it is in the data-main attribute and then it calls define("/main.js").

So, the thing is that the require.js file has the main.js code, but the page still fetch the main.js file when it shouldnt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment