-
Notifications
You must be signed in to change notification settings - Fork 35
PropTypes defaults lost when shimmed #51
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
Comments
Well, I keep debugging a little more and found that the object describing propTypes is not the same when using I think this is the problem... as the default value never validates to Why is the response object from Thanks again, I'll wait for you response to see how can I proceed |
Hi, Vue type validation should be bypassed when vue is used in production mode. This is why both type and validator properties are empty. On the other side default should be kept unchanged. Right know I cannot check it out, but I will check it as soon as possible and report back to you. |
Thanks for your help, I'll be waiting for you input! |
Hi, I think you're right. The issue arises with some type or props (like I've published a 1.5.1 version under the @next flag with correct types. This should solve your problems. You can try it out with:
Let me know if it works for you. |
Hello again!, first of all, thank you very much for your quick reply; I've checked all the code you pushed today and that is amazing!! Bad news, although, is I've checked with this new version and the problems are still there. I think adding the As I've suggested, the problem seems to be with the I'm thinking I'm seeing these problems because, as I mentioned before, I'm using I think this might be something that could potentially happen to anyone else working on an |
Hi, Ok maybe I got where part of the problem is: you built the library for production, but you're using that library in a development environment. I think you should use the source (or a bundler compatible version) of your library. This way you'd set the production or development environment in the final app. That said I agree that setting the shim validator to true won't hurt. |
@adrian-marcelo-gallardo I published v1.5.2 Let me know if it works 😄 |
Hey, I'm not seeing errors anymore, so I believe that did the trick!! :) Thank you very much for your HUGE help! |
Cool! I've published a stable release as v1.5.3. I'm closing the issue for now. Feel free to reopen it if any other issue arises. |
Hello!, I'm using this library to add proptypes to a library of componentes.
Then, I'm building those components as a library (using
vue-cli
) and adding the option in webpack to replaceVueTypes
for theshim
version.Then, I'm using that generated library on other Vue application. The problem is that when that application runs, default values aren't applied, and this is causing huge error because function handlers are undefined and application crashes..
I don't know why is this happening, because when I look at the generated code of the library (the one that I'm building with
vue-cli
) I can see there is the prop types definition usingshim
object to define the defaults, and using chrome debugger I can see that the values thatshim
is applying are valid; BUT, when adding aconsole.log
on my componentscreated
hook my default values areundefined
.If I remove the option in webpack to shim the library, then it works OK! (
console.log
on my component's hook is now defined)Do you have any idea why might this be happening? I would really like to understand why is this problem happening
Thanks a lot in advance!
The text was updated successfully, but these errors were encountered: