New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yeoman init with Require.js fails #251
Comments
More notes from our discussion about this earlier:
|
@addyosmani This has been the case since #206 See #206 (comment) |
@codedsignal ya. wasn't able to reproduce a few days ago. We need to figure this out this week. |
@addyosmani I have no doubt that you will :) Undying respect to you and the crew for your awesome efforts so far. |
@mklabs I've been taking a look at this for the past few hours and I feel we're close to getting it right, or at least understanding whats been breaking. Opting for a more explicit path in the index.html data-main (e.g
gives us a That's great, but then you try running in This was a little strange to me because I would have thought that these files would all have been combined and minified correctly. I then experimented with toggling the r.js
type files generated (which is fine). Unfortunately, this means that we're missing something that links all of these files up together to the application. Ideally, my expectation would be they would all just be compiled and executed as needed on page load. I remember adding an r.js specific build profile around I/O for us to workaround the usemin/rev issues and wonder if this is that problem showing its head again. Unfortunately, even that option is a bit of a challenge at the moment because of the usemin handle issue I reported a few days ago. I'll experiment further and see if theres another workaround that can get the finally built output to do what we expect. |
Strange indeed.
I would have said the same thing. rjs should output in the final main.js file, all the files combined (minified should probably be left to the min task). It it's not, then we have a problem here. Having files around that are revved shouldn't be an issue, as they shouldn't be referenced via any If you can push your test case in some branch (prob in your yeoman fork), I would be happy to try reproduce the error and investigate further with you. |
@mklabs pushed what I have to the requirejsconfig branch of this repo. |
Thanks Addy, I'll take a look asap. |
@mklabs were you able to find out if there was anything else behind this issue? |
Unfortunately, nope, I didn't have the chance / time to take a look (just yet). |
@addyosmani, it looks like usemin is specifying the data-main attribute as the source to be appended instead of the built file, which is why you aren't getting the modules in the built source. The generated index defines the outfile as amd-app.js, not 'scripts/main' (the data-main attribute). If I change line 230 in usemin.js from |
@jsoverson Thanks for looking into this!. Does that also result in a successful |
Yes, dist/ accessed via |
@jsoverson if you get a chance could you verify the latest changes landed above work as expected? Everything seems to be fine other than an exception that runs regardless of build type ( @sindresorhus are you able to reproduce? |
I still need to manually add Personally, as an r.js user, I would prefer it to just be part of the template and avoid much internal magic that makes the config potentially more prone to later confusion or conflict. Maybe an rjs config generator that would parse the project and offer suggestions is something that could fall into the scope of a Yeoman addon. Let me know if that's something that would make sense in Yeoman somewhere. |
I'll experiment with this further and land the change if its absolutely needed for the build. I think a hardcoded fix in the Gruntfile.js template would make sense here. |
I also like the idea of this. Lets discuss it further for the next version of the project at some point. |
Going to leave this open for further testing. Once we're confident that |
@jsoverson can you confirm the latest works for you? |
Latest works for me All |
Perfect! Thank you :) |
I discovered this while implementing #246.
Basically, if you accept all
yeoman init
options and runyeoman server
, checking the console - you'll notice that it says there is a missing config file for Require.js. Runyeoman build
however and everything builds fine, so its a paths issue.Also interesting: in your
index.html
file if you set the data-main for Require.js toscripts/main
(or whatever, as long as its the full path) you can getserver
working, but then build fails.The text was updated successfully, but these errors were encountered: