Using with Vite

Starting with Webix Jet 3.0, the toolchain has been migrated to Vite. Read more about it herearrow-up-right. There are some differences from usage with WebPack:

  • the .env file is added, it stores global constants:

APPNAME=Demo
VERSION=1.0.0
BUILD_AS_MODULE=false

To refer to the constants, use import.meta.env.{name}:

// app.js
const defaults = {
    id 		: import.meta.env.APPNAME,
    version : import.meta.env.VERSION,
    router 	: import.meta.env.BUILD_AS_MODULE ? EmptyRouter : HashRouter,
    debug 	: !import.meta.env.PROD,
    // ...
};

...

if (!import.meta.env.BUILD_AS_MODULE){
	webix.ready(() => new MyApp().render() );
}
  • the app.js contains section that imports all files from the "views" folder and assigns custom view resolver to the app class:

  • optional, app.js contains custom locale loader:

  • replace old scripts:

  • the dev server is at http://localhost:5173.

You can see the full code of the demo herearrow-up-right.

Last updated