Closed mreinstein closed 11 years ago
Thanks for the detailed report. I know there are some race conditions where the require.js configuration won't yet be extracted at the time when the require
/define
calls are resolved. Could you try defining the require.js config in an inline script in your HTML instead using this syntax?
<script>
var require = {
paths:
backbone : 'vendor/backbone-amd/backbone'
deepmodel : 'vendor/deep-model'
...
};
</script>
<script src="/js/vendor/requirejs/require.js" data-main="/js/app"></script>
That's a lot of stuff to jam into the index file. It's a sizable app. Can the race conditions be fixed? Based on the numerous examples Ive seen, this is a very common way apps are set up. If requirejs compatibility is a goal, this is important IMO.
I agree, and it's certainly on my list. I asked you to try the above so I'd know whether this is a separate issue.
Fair enough. Ill wire it up and let you know what happens
Hmm, that turned out not to be the problem. I've created a stripped-down test case based on your description, and it does indeed look like the module names aren't resolved relative to your data-main
module. I'm working on a fix. In the mean time you can avoid the bug by using an explicit baseUrl
setting:
require.config {
baseUrl: '/js'
paths:
backbone : 'vendor/backbone-amd/backbone'
deepmodel : 'vendor/deep-model'
...
}
@papandreou sorry I didn't get to the test before you did. the baseUrl does indeed bypass the problem for now. Thanks!
No prob, had all the info I needed in your report. Fixed in 1.7.5.
nice!
I've tried running assetgraph-builder against my requirejs backed code. I've run into some build problems:
Here is my the line from my index.html which includes require.js:
According to requirejs documentation, the basePath should now be set to
/js
. Instead it seems like it's being set to the index.html directory (I'm assuming it's just using what I set for--outroot
.) Here's some parts of my requirejs config (from /js/app.js):My project directory structure:
My build command:
Here are some of the errors I'm seeing: