diff --git a/src/platform/web/ui/session/settings/SettingsView.js b/src/platform/web/ui/session/settings/SettingsView.js index ffc20f25..f375a4be 100644 --- a/src/platform/web/ui/session/settings/SettingsView.js +++ b/src/platform/web/ui/session/settings/SettingsView.js @@ -142,9 +142,12 @@ export class SettingsView extends TemplateView { } } + async function openLogs(vm) { - const logviewerUrl = (await import("@matrixdotorg/structured-logviewer/index.html?url")).default; - const win = window.open(logviewerUrl); + // Use vite-specific url so this asset doesn't get picked up by vite and included in the production build, + // as opening the logs is only available during dev time, and @matrixdotorg/structured-logviewer is a dev dependency + // This url is what import "@matrixdotorg/structured-logviewer/index.html?url" resolves to with vite. + const win = window.open(`/@fs/${DEFINE_PROJECT_DIR}/node_modules/@matrixdotorg/structured-logviewer/index.html`); await new Promise((resolve, reject) => { let shouldSendPings = true; const cleanup = () => { diff --git a/vite.config.js b/vite.config.js index 87e3d063..97fb8885 100644 --- a/vite.config.js +++ b/vite.config.js @@ -37,6 +37,8 @@ export default defineConfig(({mode}) => { "sw": definePlaceholders }), ], - define: definePlaceholders, + define: Object.assign({ + DEFINE_PROJECT_DIR: JSON.stringify(__dirname) + }, definePlaceholders), }); });