Using with Vite
Starting with Webix Jet 3.0, the toolchain has been migrated to Vite. Read more about it here. There are some differences from usage with WebPack:
the
.envfile is added, it stores global constants:
APPNAME=Demo
VERSION=1.0.0
BUILD_AS_MODULE=falseTo 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.jscontains 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 here.
Last updated