Hi again,
actually I am trying to get the “Resolving Files” demo to work. The url “http://localhost:5174/viewresolve/#!/top/start” returns “404: Page not found”. Shouldn’t the url point to “areae.list” view?
I’m afraid there’s an issue in our example, thank you for pointing this out!
We will fix is as soon as possible.
The definition views: {"start" : "area.list"} is not applicable to a newer version of Jet.
After switching to Vite (Jet 3.0+), the app configuration requires a custom view loader, similar to the function mentioned above or a direct assignment of an imported module
With that said, the correct code for this demo will be
Click to expand code for sources/viewresolve.js
// sources/viewresolve.js
import {JetApp} from "webix-jet";
import { views } from "./views/index";
const app = new JetApp({
start: "/top/start", // "start" should represent module from "views/area/list.js"
views,
});
export default app;
Click to expand code for sources/views/index.js
// sources/views/index.js, dynamic import of views
// note: because of the placement of this file in the project,
// this relative path points to all files in "views" folder and all its subfolders
const modules = import.meta.glob("./**/*.js");
// custom aliases
const aliases = {
start: "area.list"
};
export const views = (name) => {
if (aliases[name]) name = aliases[name];
const mod = modules[`./${name.replace(/\./g, "/")}.js`];
if (!mod) return modules["./404.js"]().then((x) => x.default);
return mod().then((x) => x.default);
};