-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: add lodash/fp #19
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 1 1
Lines 20 21 +1
Branches 6 6
=====================================
+ Hits 20 21 +1
Continue to review full report at Codecov.
|
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.
LGTM.
I would just change the commit message to something more explicit like:
chore: add lodash/fp as default id on babel-plugin-lodash
This is just an opinion but |
index.js
Outdated
[require.resolve('babel-plugin-lodash')], | ||
Object.assign({}, | ||
options.lodash, | ||
{ id: options.lodash.id ? defaultLodashOptionsIds.concat(options.lodash.id) : defaultLodashOptionsIds }), |
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.
We should document the defaults in the README and perhaps add an example adding recompose?
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 agree, i will add the information with an example in the README.
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.
+1
I agree with having a more specific commit message. |
index.js
Outdated
@@ -94,9 +94,13 @@ module.exports = (context, options) => { | |||
|
|||
// Cherry-pick lodash modules for smaller bundles | |||
if (options.lodash) { | |||
const defaultLodashOptionsIds = ['lodash/fp']; |
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.
Looking at https://github.com/lodash/babel-plugin-lodash/blob/master/src/config.js#L17, I think that when we pass id
, it completely overrides the default ones. This means that we must include all those defaults.
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 has been reported in this issue. lodash/babel-plugin-lodash#184 .
We can re-include the defaults, but we should be concerned about future fixes on this matter.
6441c21
to
922addf
Compare
922addf
to
5f3a17a
Compare
index.js
Outdated
[require.resolve('babel-plugin-lodash')], | ||
Object.assign({}, | ||
options.lodash, | ||
{ id: options.lodash.id ? baseLodashOptionsIds.concat(options.lodash.id) : baseLodashOptionsIds }), |
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.
Can this be changed to:
{ id: baseLodashOptionsIds.concat(options.lodash.id || []) }
? It's a bit simpler.
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.
👍
"lodash-es", | ||
"lodash-compat", | ||
"lodash/fp", | ||
"lodash-compat", |
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.
There's a repeated lodash-compat
here. Can you change the test to use recompose
instead?
README.md
Outdated
|
||
Transform to cherry-pick Lodash modules is enabled. | ||
|
||
`lodash-es` `lodash-compat` and `lodash/fp` are added by default, but you can cherry-pick any module you need as long as you specify it on `options.id`. |
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 we change this part to:
Specify which modules will have the cherry-pick transformation applied.
Note that lodash-es
, lodash-compat
and lodash/fp
are always added for you, regardless of having this option defined or not.
For instance, to have smaller bundles when using recompose:
5f3a17a
to
9f9878e
Compare
README.md
Outdated
|
||
Note that `lodash-es`, `lodash-compat` and `lodash/fp` are always added for you, regardless of having this option defined or not. | ||
|
||
For instance, to have smaller bundles when using [recompose](https://github.com/acdlite/recompose) : |
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.
Please remove extra space before :
.
9f9878e
to
e7d65c2
Compare
@AfonsoVReis I would consider this a |
Yes @satazor , i agree this is |
e7d65c2
to
2c30efe
Compare
Changed to feat instead of chore. |
Closes #18 .