drikusroor / vue-bootstrap-autocomplete

An autocomplete/typeahead component for Vue 2 and Bootstrap 4
https://drikusroor.github.io/vue-bootstrap-autocomplete/
MIT License
2 stars 11 forks source link

Vite - lodash import don't work #9

Open tofi86 opened 1 year ago

tofi86 commented 1 year ago

First of all: Thanks for continuing the project! 👏

Then, I have the same problem running this component with Vite as described in https://github.com/mattzollinhofer/vue-typeahead-bootstrap/issues/162

Any chance to get this fixed?

Thanks!

guijsbr commented 1 year ago

I'm also running into this problem after migrating to Vite.

Uncaught SyntaxError: The requested module '/node_modules/lodash/clone.js?v=abb217ab' does not provide an export named 'default' (at VueBootstrapAutocompleteList.vue:50:8)

dallasbeek commented 1 year ago

Same :(

dallasbeek commented 1 year ago

I was able to patch-package mine by. adding lodash-es reference from my project (npm i lodash-es)

and changing VueBootstrapAutompleteList import { clone, includes, isEmpty, reject, reverse, findIndex } from 'lodash-es'

guijsbr commented 1 year ago

I was able to patch-package mine by. adding lodash-es reference from my project (npm i lodash-es)

and changing VueBootstrapAutompleteList import { clone, includes, isEmpty, reject, reverse, findIndex } from 'lodash-es'

I was going to say I did exactly the same for test purposes. But I modified the file directly, which I know is wrong. Is there a way to apply this patch through Vite or something so I don't lose the code if I run NPM install?

dallasbeek commented 1 year ago

I was able to patch-package mine by. adding lodash-es reference from my project (npm i lodash-es) and changing VueBootstrapAutompleteList import { clone, includes, isEmpty, reject, reverse, findIndex } from 'lodash-es'

I was going to say I did exactly the same for test purposes. But I modified the file directly, which I know is wrong. Is there a way to apply this patch through Vite or something so I don't lose the code if I run NPM install?

Patch-Package is your friend for this https://www.npmjs.com/package/patch-package. It creates a package file and applies changes to the node-modules folder when performing npm install. If you need further help, let me know.

guijsbr commented 1 year ago

@dallasbeek thank you!