Vite - import and use when there are no exports
Hello people,
So I need to use an old JS module called FancyProductDesigner (there is a newer, open source version but for the time being I'm stuck with this really old one). Basically I want to simply load it on the page and use it in a script further. The thing needs a few files, so I created a resources/fpd/js/bootstrap.js file with content:
import '../../js/jquery-ui.min.js';
import './fabric.min.js';
import './FancyProductDesigner-all.min.js';
And then on the page:
@vite('resources/fpd/js/bootstrap.js')
<script type="module">
const fpd = new FancyProductDesigner(arg1, arg2);
Of course FancyProductDesigner is not defined. I would need to define it on the window object for it to be accessible like that - I did the same with a few other modules, like jQuery. So trying in my bootstrap.js file:
window.FancyProductDesigner = FancyProductDesigner;
It builds but still, FancyProductDesigner is not defined. Also, the file FancyProductDesigner-all.min.js itself doesn't export anything.
Thanks ahead!
Please or to participate in this conversation.