Webix-jet pro - Vite import

Hi,

How do I import my pro library into a vite webix-jet project?

-Tomas

Hello @TomasF ,

To import your Pro library into a Webix Jet project, you need to ensure that the webix variable is accessible in the global context before you include or import any complex widgets. Here are the common approaches to achieve this:

  • You can include the Webix library using a script tag in your index.html file. This ensures that the webix variable is available globally:

    <script src="../node_modules/@xbs/webix-pro/webix.js" type="text/javascript"></script>

  • If you prefer to use imports, you must ensure the webix variable is defined globally. You can do this by manually assigning it after importing:

    import * as webix from "@xbs/webix-pro";
    window.webix = webix;
    

Please take a look at our jet-start demo, which is build with Vite and uses dynamic import . Here you can see how webix library is added into the app. For demonstration purposes, the demo uses assets for the main library from our CDN.

Hi,

I have it as a webix.min.js. How is that imported into vite?

Thanks.

Hello,

You can add a <script> tag in your index.html file to load webix.min.js this way :

<script src="../path/to/your/webix.min.js" type="text/javascript"></script>

If to use imports, you can do this by importing the file and assigning it to the global window object:

import * as webix from "../path/to/your/webix.min.js";
window.webix = webix;