Duplicate dependencies
# package-development
d
I just created an extension using a JS library sortable.js. I installed it using node in the extension, I assume there is a way to link to the CDN for the back office but I am sure that is not good practice. If there are 6 packages installed in a site all using sortable.js this is not good practice either. Am I missing something?
Is there a way to install JS libraries and other dependencies globally for use in the back-office? Would this cause issues with different versions of said library in different packages?
j
Yes, that could cause version conflicts if there were. It's perfectly reasonable to depend on Sortable directly and then use a bundler with tree-shaking (Vite, for example), so you only bring what you need. The overhead shouldn't be too large.
Or you could try the UmbSorterController if that fits your needs
d
Thank you @Jacob Overgaard , sortable.js was just an example but good to know.
3 Views