Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JerryBels's avatar

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?

0 likes
0 replies

Please or to participate in this conversation.