diff --git a/custom_ui/custom_ui/page/custom_ui/custom_ui.js b/custom_ui/custom_ui/page/custom_ui/custom_ui.js index d4ed85e..3d0de57 100644 --- a/custom_ui/custom_ui/page/custom_ui/custom_ui.js +++ b/custom_ui/custom_ui/page/custom_ui/custom_ui.js @@ -1,10 +1,12 @@ -frappe.pages["custom_ui"].on_page_load = function (wrapper) { +frappe.pages["custom_ui"].on_page_load = async (wrapper) => { $(wrapper).html('
'); console.log("App root div created"); const script = document.createElement("script"); - script.src = "/assets/custom_ui/dist/assets/custom_ui.bundle.js"; + manifest = await fetch("/assets/custom_ui/dist/.vite/manifest.json").then((res) => res.json()); + console.log("Fetched manifest:", manifest); + script.src = "/assets/custom_ui/dist/" + manifest["src/main.js"]["file"]; script.type = "module"; document.body.appendChild(script); console.log("Custom UI script loaded:", script.src); diff --git a/custom_ui/hooks.py b/custom_ui/hooks.py index 9285381..545b2b2 100644 --- a/custom_ui/hooks.py +++ b/custom_ui/hooks.py @@ -11,9 +11,9 @@ after_install = "custom_ui.install.after_install" after_migrate = "custom_ui.install.after_migrate" # on_session_creation = "custom_ui.utils.on_login_redirect" # on_login = "custom_ui.utils.on_login_redirect" -# page_js = { -# "custom_ui": "custom_ui/custom_ui/page/custom_ui/custom_ui.js" -# } +page_js = { + "custom_ui": "custom_ui/custom_ui/page/custom_ui/custom_ui.js" +} # app_include_js = ["/assets/custom_ui/dist/assets/main.js"] diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 182d1ff..d3139c5 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -10,12 +10,7 @@ export default defineConfig({ emptyOutDir: true, manifest: true, rollupOptions: { - output: { - input: resolve(__dirname, "src/main.js"), - entryFileNames: "assets/custom_ui.bundle.js", - chunkFileNames: "chunks/[name].js", - assetFileNames: "assets/[name].[ext]", - }, + input: resolve(__dirname, "src/main.js"), }, }, server: {