-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Upgrading deps #446
Upgrading deps #446
Conversation
.size-snapshot.json
Outdated
@@ -1,21 +1,21 @@ | |||
{ | |||
"dist/react-beautiful-dnd.js": { | |||
"bundled": 372617, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main code change i can see is our moving from throw new Error
to invariant
in an attempt to reduce kb's in tree shaking. However, it looks like our umd bundle went up. Any thoughts @TrySound ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know to be honest.
@lukastaegert what was changed in the latest versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the snapshot on master so we are sure we are looking at the correct thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at the build and it is not creating multiple copies of invariant..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be a transitive dependency change..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, i reversed the invariant usages changes and i can confirm that the size changes did not come from there
@@ -364,15 +364,15 @@ export type DropState = {| | |||
result: ?DropResult, | |||
|} | |||
|
|||
export type State = { | |||
export type State = {| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now an exact type
.size-snapshot.json
Outdated
"gzipped": 35556 | ||
"bundled": 360109, | ||
"minified": 132835, | ||
"gzipped": 37619 | ||
}, | ||
"dist/react-beautiful-dnd.esm.js": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our esm builds are looking better for moving to invariant rather than throwing, but otherwise we took a huge hit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for using invariant over throw
statements? Did you notice any effect on Flow's ability to narrow the types on things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the reason for using invariant:
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
Flow understands that invariant will throw if the condition is not met
"raf-stub": "^2.0.2", | ||
"react": "^16.3.1", | ||
"react-dom": "^16.3.1", | ||
"react-test-renderer": "^16.3.1", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.56.2", | ||
"rollup": "^0.58.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be the cause?
[email protected], babylon@^7.0.0-beta.40: | ||
version "7.0.0-beta.42" | ||
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.42.tgz#67cfabcd4f3ec82999d29031ccdea89d0ba99657" | ||
[email protected]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might also be the cause
rollup@^0.56.2: | ||
version "0.56.5" | ||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.56.5.tgz#40fe3cf0cd1659d469baad11f4d5b6336c14ce84" | ||
rollup@^0.58.0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could have caused it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah i just checked
Given that the regression is only for the UMD bundle i am tentatively okay to proceed. We cannot reasonably stay on old deps to avoid the kb hit. Although i do think it very worthwhile to investigate the cause. Any takers @lukebatchelor @TrySound ? |
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^8.2.1", | ||
"babel-core": "^6.26.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No babel-core before this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was being brought in by another dep. now we are being more explicit
@@ -134,10 +134,11 @@ export const scrollDroppable = ( | |||
clipped, | |||
}; | |||
|
|||
return ({ | |||
const result: DroppableDimension = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does flow complain without this cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope! it now works with exact types and spread
@@ -266,13 +266,13 @@ export default (state: State = clean('IDLE'), action: Action): State => { | |||
return existing; | |||
} | |||
|
|||
const newDrag: DragState = ({ | |||
const newDrag: DragState = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could clean up the Flow annotations by typing this IIFE like:
const drag = ((): ?DragState => {
// ...
})();
So, looking at the diff of the two bundles (before and after this PR) I get an interesting result. Immediately I see the new bundle has invariant bundled at the top and in each place the old bundle has a null check and a throw, the new bundle has a call to invariant. Strangely, further down I do then see a copy of invariant in the old bundle though (one that is not included in the new bundle)... So.. You would assume these would cancel each other out no? Also, all of invariant including the license header is 1.4k, a lot less that the 38k difference we are seeing reported? Overall, just looking at the diff, if anything I would actually expect the old bundle to be bigger... I'll show you the diff when you're around. |
Oh, also worth noting, the actual sizes I'm getting don't match the output above
Only 145 bytes difference. |
@@ -44,7 +44,6 @@ | |||
}, | |||
"dependencies": { | |||
"babel-runtime": "^6.26.0", | |||
"invariant": "^2.2.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gone!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote my own. I will put it on npm soon.
@@ -44,7 +44,6 @@ | |||
}, | |||
"dependencies": { | |||
"babel-runtime": "^6.26.0", | |||
"invariant": "^2.2.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote my own. I will put it on npm soon.
src/invariant.js
Outdated
@@ -0,0 +1,21 @@ | |||
// @flow | |||
|
|||
const isProduction: boolean = process.env.NODE_ENV === 'production'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why complicate things? a super simple invariant function that actually works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested the bundles and the messages are now being stripped correctly
"memoize-one": "^3.1.1", | ||
"prop-types": "^15.6.0", | ||
"raf-schd": "^2.1.1", | ||
"react-motion": "^0.5.2", | ||
"react-redux": "^5.0.6", | ||
"redux": "^3.7.2", | ||
"redux-thunk": "^2.2.0", | ||
"reselect": "^3.0.1" | ||
"reselect": "^3.0.1", | ||
"tiny-invariant": "^0.0.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right now i have not figured out how to get our rollup build to tree shake the env conditional insight of this module. However, i am happy to solve that later
I have no idea where the extra 27,156 bytes came from... I had a look at the diff and i cannot see how we got such an increase Original cat dist/react-beautiful-dnd.js | wc -c
372696 New cat dist/react-beautiful-dnd.js | wc -c
399852 |
Given that it will only impact the umd distribution i am okay to proceed at this point. However, it would be worth getting to the bottom of this one |
This could be relevant:
|
Seems like the problem with size and missing exports is related to new rollup version and core-js. |
Yep, it's regression in rollup |
Thanks @TrySound. I will merge this PR as is and we can create a follow up issue to fix the umd build |
No description provided.