forked from mystiq/hydrogen-web
don't include log viewer in production build
This commit is contained in:
parent
f6ea7803f2
commit
e2621015e1
2 changed files with 8 additions and 3 deletions
|
@ -142,9 +142,12 @@ export class SettingsView extends TemplateView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function openLogs(vm) {
|
async function openLogs(vm) {
|
||||||
const logviewerUrl = (await import("@matrixdotorg/structured-logviewer/index.html?url")).default;
|
// Use vite-specific url so this asset doesn't get picked up by vite and included in the production build,
|
||||||
const win = window.open(logviewerUrl);
|
// 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) => {
|
await new Promise((resolve, reject) => {
|
||||||
let shouldSendPings = true;
|
let shouldSendPings = true;
|
||||||
const cleanup = () => {
|
const cleanup = () => {
|
||||||
|
|
|
@ -37,6 +37,8 @@ export default defineConfig(({mode}) => {
|
||||||
"sw": definePlaceholders
|
"sw": definePlaceholders
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
define: definePlaceholders,
|
define: Object.assign({
|
||||||
|
DEFINE_PROJECT_DIR: JSON.stringify(__dirname)
|
||||||
|
}, definePlaceholders),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue