Oct 8, 2022
0
Level 1
Vite (or webpack) isolating parts that needs to work together
Hey guys, I'm using a date picker for my project. I need a plugin for customizing date format. I added to my app.js :
import tempusDominus from '@eonasdan/tempus-dominus/dist/js/tempus-dominus';
window.tempusDominus = tempusDominus;
import customDateFormat from '@eonasdan/tempus-dominus/dist/plugins/customDateFormat';
window.tempusDominus.extend(customDateFormat);
When compiled with Vite (or webpack, I tried with both) I understand bits of imports are isolated from each other. Well, in my case, a bit of code in the plugin uses something from the main, which triggers an error Uncaught TypeError: this.errorMessages.customDateFormatError is not a function . Indeed, it's a function declared in the first part of the code.
What can I do? I guess there should be a way to tell vite (or webpack) NOT to isolate some parts from each other?
Please or to participate in this conversation.