-
Notifications
You must be signed in to change notification settings - Fork 210
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
fixed rt-class to also work with lodash 4.5.0 #110
Conversation
…sh 4.5.0 and now works differently than in 3.10.0
@idok , can you please review this? :) |
Would love some feedback on this from Wix. Any plans on merging? |
@idok @avi @DanShappir please help fellow react-templaters ;) |
Committed in e56cd6d. |
Thanks for the bug fix but I seem to be still experiencing a problem with using rt-class. The problem is that "_" is not a function if I do "import * as _ from 'lodash'". However, if I do "import _ from 'lodash'", it seems to work? Is it because it is importing from my own node_modules/lodash and not node_modules/react-templates/node_modules/lodash? Thanks in advance. |
Do you use babel as transpiler? You should check that
is transpiled into
I don't use babel myself, but I remember people discussing about babel changing the way it does default imports. Also do you experience the problem in |
Strangely But I have to do explicitly change it to `import _ from 'lodash' if I want it to work with rt-class. Is it due to my installation of lodash? Perhaps |
You don't need to import lodash in templates, as it is already imported by default (along with react). So it must be something else. Can you please quote the rt-class code that is causing trobles? |
I seem to be having the same problem as @alandu50 . I'm using Babel, Webpack, etc. This
Not sure if it's related but I'm using this in
|
Ok, I think I've found it. The problem is in how babel transpiles the Since it doesn't recognize You can see all that in the following transpiled code:
I don't know why All that said, I think we still could fix the original issue by turning: _({ web: true }).transform(function (res, value, key) { ... } into _.transform({ web: true }, function (res, value, key) { ... } thus avoiding the call to But users should be aware that they are not working with the correct |
Thanks, good spot, would it be possible for this change to be committed? |
@nippur72 will this be merged soon? I can't seem to come up with a work around for now. |
@evanpurkhiser I'm not the maintainer so I can't say if it will be merged either. For my projects I use a fork of my own where the pending PR are all merged. |
Ahh sorry @nippur72, I misread your Hopefully your fix can be committed soon, since it appears to be unusable for those using babble to transpile their templates. |
Fixed rt-class so it won't depend on _.pick which was changed in lodash 4.5.0 and now works differently than in 3.10.0
Related issue:
#105