Answer the question
In order to leave comments, you need to log in
Vue.js is it possible to override component file from node_modules without crutches?
For example: in vue cli projects, I often use the well-known vue-select component, it is quite convenient, but it does not have what I need, namely displaying options in the form of html code and not text. I can easily change the node_modules/vue-select/src/components/Select.vue file and fix what I need, but it will be a bike crutch because you can’t just take and change the file in the node_modules folder (perhaps the universe will collapse or worse, another the update will just overwrite my work)! I honestly googled but did not find a way to simply take and redefine one file from the component so that web-pack would render it instead of the original. Please tell me what is the most righteous way to solve such a problem, there are a lot of good things in npm, but sometimes I want to do even better and I have too many crutches in my projects, thanks.
update1: With regard to vue-select specifically, my example is inappropriate, since I overlooked that it still has such an opportunity, but what about components that cannot be extended by the methods of the components themselves?
Answer the question
In order to leave comments, you need to log in
If the need is adequate - add the code, make a PR to the author and enjoy the next version.
If you have a special need, fork and either publish to npm (there are no restrictions on this) in your namespace, or simply put it in the project and link your local version through link:./path
or file:./path
.
Monkey patching one specific file is not an option (although any crutches are technically possible - webpack is freely expandable with plugins), because in the next version of either, the author can completely redraw the internal structure and everything will break for you.
I use the well-known vue-select component, it is quite convenient, but it does not have what I need, namely displaying options in the form of html code and not text
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question