-
Notifications
You must be signed in to change notification settings - Fork 34
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
mimosa modules optimize. #297
Comments
I think I know the problem you are having. I ran into it too. It's an issue with source maps. Let me see if I can figure out a workaround. I suspect if you do a |
yes! the source maps, i can live with odd source maps :) but i get this in firebug: NetworkError: 404 Not Found - http://test.lvh.me:3000/javascripts/main-built.js My layout has:
I have a common.js, similar to the example app, the main1 in example app is main here, thats the only change. Seems like when its optimizing, it does not take into account the modules config and paths in common. I would have expected, each module (the dependencies within that module are compiled automatically by r.js into the final js file, we don't care about those) mentioned in the module config to have compiled into a minified optimized js file in public with the module name as the name of the file. Let me know if i am missing anything. |
The modules are still workable though and do provide a performance improvement over the earlier mimosa, just that there is a request made to get each file, which can be avoided by having just one request to a compiled optimized module file, which would be ideal. |
I'm afraid I'm not fully understanding. You are having an issue with the example app as it stands? And "just that there is a request made to get each file, which can be avoided by having just one request to a compiled optimized module file, which would be ideal" <= I'm afraid this isn't make sense to me. You have the ability to create the optimized files now. So what would be ideal? |
Sorry, let me be more precise: The structure is same as the example app. This is a part of what common looks like:
This is what main1 looks like:
This is what mimosa config looks like:
Now what is happening in terms of requests, is that there are 1 GET request for each of those required files (total of 5), which should have been just one js file called "main1.js", which had all those 5 files in it, IF it was optimized. (the name would be main1.js since we defined it in mimosa config and r.js automatically adds those 5 dependencies during optimization unless we use 'exclude' and exclude certain files) IF its not optimized, 5 GET requests are totally normal, and that works great for now. Hope that makes it clear. |
So to paraphrase, for the above scenario, when you optimize, you are not seeing the requests reduce down to 1? The requests stay at 5. |
Yes, the requests stay at 5 for the optimized version too. |
Using the MimosaDynamicRequire I see all the requests I expect and none of the requests I do not expect. Could you fork that repo to create the situation that is the problem? |
As far as running I am going to release an update that allows You probably should be doing your dev with optimization turned off anyway. Being able to run |
I had a couple ideas on this come to me overnight. May give fixing the source map, running I do need a concrete example of something not optimizing properly though. A github repo would be perfect. |
I've made some progress, but it appears as if, for now, having source maps work with each subsequent compile will be an enormous undertaking. I can get source maps to work for the first run, but every subsequent run will fail because of the added source maps from the previous run. So my choices are:
I think source maps are fairly important here, but I think disabling and letting you re-enable for 1 run attempts with them might be the way to go. |
https://github.com/dbashford/mimosa/blob/master/RELEASENOTES.md#major-changes I've address the ability to re-run optimization for Still need some confirmation and an example app for |
FYI, if you are doing modules work, may want to check https://github.com/twill88/mimosa-requirebuild-module-include |
Hey, sorry about the delayed reply, been super crazy at my end, thanks, i have just shared an app that i am trying to port over to mimosa with you, you could start it up the usual way, and goto: http://test-college.lvh.me:3000/sign-up and after signing in, this page might be a good example of why wrapping the js files into one would be a good idea: http://test-college.lvh.me:3000/app#account-settings If you will notice in the forms_layout.coffee, we have these bunch of js files, and in the firebug we have each one of them being fetched individually. And if i try to optimize, i get this(notice that mimosa config does not have a list of modules, i have not committed that in yet): NetworkError: 404 Not Found - http://test.lvh.me:3000/javascripts/main-built.js Thanks for the tip on that requirebuild, i will definitely look into it this week and let you know! |
If you are optimizing via https://github.com/krokhale/skynet-node/blob/master/views/layout.jade#L34 I assume that is your base layout. You are including both the This...
should be this...
When you use modules, you still need require.js because you still need to async load things in. See the DynamicModule code here: https://github.com/dbashford/MimosaDynamicRequire/blob/master/views/layout.jade#L11 |
Any chance to take a look? Any trouble? |
Closing this. Feel free to open something new with details/specific.s |
I am in the process of porting over an app to use the modules in mimosa, its working for the most part as we had discussed in an earlier ticket, though when running the watch with an optimize option, it blows up, i will try to post a more detailed error log later, but just a heads up, let me know if optimization with modules works as expected for you. Thanks!
The text was updated successfully, but these errors were encountered: