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
Allow direct imports to reduce bundle size. #2893
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2893 +/- ##
======================================
Coverage 100% 100%
======================================
Files 68 67 -1
Lines 1404 1407 +3
======================================
+ Hits 1404 1407 +3
Continue to review full report at Codecov.
|
Can you check #2315, please? BTW, what a huge PR! |
For me since I was also using lodash, it is shared so that is not a problem. The problem was the factory index files that prevented direct imports. |
Wow! That's an impressive PR! Well done. Thank you for your time. |
|
||
Use `es` if you are using a bundler that can process ES modules like `webpack@2` or `rollup`, otherwise use `lib`. | ||
|
||
The public API available in this manner is defined as the set of imports available from the top-level `react-router` module. |
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.
Oops. Missed a react-router
. 😛
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.
god dammit. Do you fix it or should I?
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.
Next time I 'inspire' myself on the work of others, do cmd+R. 10 year old me would not have done this kind of mistake. 😃
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.
Fixed in #2898
@ruiaraujo Is there some advantage to doing import { default as Foo } from './somedir/Foo' over import Foo from './somedir/Foo' ?? The latter is less explicit, but much more readable, in my opinion. |
Oops, nevermind. They are EXPORT statements. There, now we've both made absentminded mistakes on this PR. :-) |
* Add PropTypes for the Field components * Export fieldInputPropTypes, fieldMetaPropTypes and fieldPropTypes * Merged with changes from #2893
* Exports defaultShouldValidate and defaultShouldAsyncValidate These default functions are exported for external use - particularly so that a user can wrap the default functionality with specialised behaviour. To resolve #2890 * Export default shouldValidates in immutable wrapper * Allow direct imports to reduce bundle size. (#2893) * Fix deep equal on maps with different structures (#2892) * Remove references to react-router from doc page. (#2898) * Add PropTypes for the Field components (#2862) * Add PropTypes for the Field components * Export fieldInputPropTypes, fieldMetaPropTypes and fieldPropTypes * Merged with changes from #2893
Ugh. (I probably would not have thought to do this either. I'm just only realizing this in retrospect.) |
Hmm, does git mv actually help with that problem?
git mv is just a mv + git add which was what I did.
…On Mon, May 8, 2017 at 6:52 PM Erik Rasmussen ***@***.***> wrote:
Ugh.
|
Hmm... So it is. I was under the impression that it would preserve the history of the file. I swear I've seen it do that before. Perhaps it only works if you don't immediately add another file with the old name...? Oh well. Nevermind then. 😄 |
Is there a timeline for this getting released. :-) ? |
} | ||
``` | ||
|
||
##Caveat (Action Creators) |
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.
From the documentation, it is not clear whether this step is automated by babel-plugin-transform-imports
or do I still need to use react-router/es/actions
when using the plugin.
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 will try to be more explicit about the problem then.
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.
LOL, even the follow-up question didn't notice the wrong library name. 😆
…ializing the form (#2835) * passing the last initialValues into initialize action if it is reinitializing the form * Added test related to #2809 * Removed meta.touched from FieldArray props (#2836) * Add props to the params documented in the field-level validations example (#2855) * Fix typo in docs/api/Field.md (#2864) * Improve SubmissionError docs (#2873) * Add a selector to get touched and visited props from state (#2859) * added a selector (getFormMeta) which retrieves the form.{$name}.fields slice from state * added documentation for getFormMeta selector * Fixed field-level validation reset bug (#2888) * deleteInWithCleanUp needs to check if there is a value in the state before deleting. (#2876) * deleteInWithCleanUp needs to check if there is a value in the state before deleting, to avoid Invalid KeyPath errors * Got rid of string compare * clean script - added es folder to be rimrafed before build (#2860) * Add a Field's initial value to props.meta.initial (#2858) * Add meta.initial to Field props for access to a field’s initial value. * es6 typo * add meta.initial to the docs for Field * Demonstrated that calling onBlur() does not change value #2768 * Better cleanup on UNREGISTER (#2889) * Checkbox default behavior proposal (#2863) instead true/false to be true/'' as the current true/false breaks pristine prop * Fancy new npm5 lock file! * Allow direct imports to reduce bundle size. (#2893) * Fix deep equal on maps with different structures (#2892) * Remove references to react-router from doc page. (#2898) * Add PropTypes for the Field components (#2862) * Add PropTypes for the Field components * Export fieldInputPropTypes, fieldMetaPropTypes and fieldPropTypes * Merged with changes from #2893 * Exports defaultShouldValidate and defaultShouldAsyncValidate (#2891) * Exports defaultShouldValidate and defaultShouldAsyncValidate These default functions are exported for external use - particularly so that a user can wrap the default functionality with specialised behaviour. To resolve #2890 * Export default shouldValidates in immutable wrapper * Allow direct imports to reduce bundle size. (#2893) * Fix deep equal on maps with different structures (#2892) * Remove references to react-router from doc page. (#2898) * Add PropTypes for the Field components (#2862) * Add PropTypes for the Field components * Export fieldInputPropTypes, fieldMetaPropTypes and fieldPropTypes * Merged with changes from #2893
Published as |
@piuccio It is the same thing to use it with immutable, just add immutable. |
where?
I suppose it's the first one, but it would be nice to have it in the doc |
Hi, I'm noticing that the Babel plugin doesn't work well with actions:
My import: import { actions, Field, reduxForm } from 'redux-form';
const { reset } = actions; This can be worked around from the user's end by changing the import statement, but I was wondering if it would be a good idea to add a default export to Alternatively, if this is happening because I'm doing something wrong, please let me know. Thanks! |
@erikras What are that |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Webpack 2 does not remove a lot of unused modules from my bundle so direct import remain the best solution to reduce bundle size.
The doc page was heavily inspired by https://github.com/ReactTraining/react-router/blob/v3/docs/guides/MinimizingBundleSize.md