-
Notifications
You must be signed in to change notification settings - Fork 3
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
Minimize browser bundle size #2
Comments
Love to see this as well. I would not mind doing a PR. I have yet to clone this repo to run builds. Does the CONTRIBUTING.md file cover the bases for development/PR stuff? Any tips, specific to this code, to make the process adding features and doing a PR (specific to this code) easier? |
To fix this, some functions of I'd propose to fix this by making a separate file and never import that file for the browser version. |
Your proposal sounds good to me. I should have some time this week and upcoming weekend to dig into helping out. Let me see if I can do a PR for this. I'll let you know either way. |
Looking at this, they 'QUERY_SEPARATOR',
'_flatten',
'_every',
'_asyncEverySeries',
'paramifyString',
'regifyString',
'terminator',
'Router.prototype.configure',
'Router.prototype.param',
'Router.prototype.on',
'Router.prototype.path',
'Router.prototype.dispatch',
'Router.prototype.runlist',
'Router.prototype.invoke',
'Router.prototype.traverse',
'Router.prototype.insert',
'Router.prototype.insertEx',
'Router.prototype.extend',
'Router.prototype.mount' With the exception of I think I am a little confused as to what to do here. Looking at the rollup files, as far as I can tell, the code is already grabbing the browser-specific code found in Correct me if I am wrong, but isn't If I am reading things correctly here, I think this issue has already been resolved? Of course, I could be overlooking something totally obvious. 😆 |
@SpaceK33z, I am sure you are busy, but do you have any thoughts on my previous comment? I think my base question is this: Is the browser code already minimized? This issue reminds me of this thought: We should separate the browser code from the node code into their own repos. 👍 Thanks! |
Yes I'm a bit busy now, but some quick things; The methods/vars you mention get extracted out of the browser bundle because they are not necessary/used for the browser. This saves some bytes. However, our Rollup bundle doesn't do that same trick. It still includes these methods/vars for the browser bundle. I think I don't agree with separating into repositories. We need to organize the code a bit better, but part of the power of this package is that it works almost the same for both platforms. They use the same codebase + some platform-specific code. We just have to make sure that the browser only loads the minimum amount of code necessary. |
Ok, that definitely helps to explain things better. EDIT/REMOVED (I was confusing Now that you clarified, I will take another look. 👍
No worries and thanks for the reply/help! |
Ok, sorry for the commotion; I see now what needs to be done. Thanks again for the clarification! 👍 |
No problem, I'm glad you're helping out 💯 |
Director used a trick to remove parts of
lib/tarantino/router.js
that are not necessary for the browser version (see here). This removed 10kb of the non-minimized bundle.I'd prefer to solve this by extracting
router.js
in two parts.The text was updated successfully, but these errors were encountered: