-
Notifications
You must be signed in to change notification settings - Fork 490
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
Upgrade to Babel 6 #15
Conversation
@@ -260,5 +260,3 @@ LazyLoad.defaultProps = { | |||
}; | |||
|
|||
export default LazyLoad; | |||
|
|||
export lazyload from './decorator'; |
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.
As far as I can tell, the default key from this file (export default LazyLoad
) is being overwritten by the default key being exported from './decorator'
. By importing from react-lazyload/decorator
directly, we don't have contention for the key.
My theory is that babel makes export
s a single object that is returned, such that if you then re-export default
something export default
, you overwrite the default
key of the returned object.
foo.js
export default () => console.log('foo');
bar.js
export default () => console.log('bar');
// would return { default: () => console.log('bar') }
export foo from foo;
// now returns { default: () => console.log('foo') }
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.
How about
// src/index.js
import decorator from './decorator';
export const lazyload = decorator;
API changes are always sore spot for module consumers.
"babel-eslint": "^6.0.2", | ||
"babel-loader": "~5.3.2", | ||
"babel-loader": "~6.2.4", | ||
"babel-plugin-transform-decorators-legacy": "^1.3.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.
This is what is recommended by Babel
I had to introduce a breaking api change, changing the import for the decorator from |
Wow that's a lot of stuff, I need some time to dive into every piece of your comment. |
Can you squash your commit and leave out |
@jasonslyvia Some great points; sorry for the long turnaround on feedback. I think this is much more reasonable pr. I'm also sorry for shoving a bunch of stuff into one pr; we did a lot of iteration before we got this working internally, and I didn't want to open a PR until it was clear we'd actually be relying on it, and our changes would work. |
@@ -0,0 +1,4 @@ | |||
{ | |||
"presets": ["stage-0", "es2015"], | |||
"plugins": ["transform-react-jsx", "transform-decorators-legacy"] |
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 use transform-react-jsx
plugin instead of react
preset?
c7ef3ab
to
9acdd21
Compare
I think we're good to go as per this PR, is there further modification you're going to make, or should I merge it now? |
I think its ready to merge! Thanks for being so patient. |
This allows us to build lazyload with babel 6