-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add description on how to develop a vite vis without sidepanel
- Loading branch information
Showing
2 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { defineConfig } from "vite"; | ||
|
||
// collect Galaxy server root | ||
let GALAXY_ROOT = "http://127.0.0.1:8080"; | ||
if (process.env.GALAXY_ROOT) { | ||
GALAXY_ROOT = process.env.GALAXY_ROOT; | ||
} else { | ||
console.log("GALAXY_ROOT not available. Please provide as environment variable."); | ||
} | ||
|
||
// collect Galaxy API key | ||
let GALAXY_KEY = ""; | ||
if (process.env.GALAXY_KEY) { | ||
GALAXY_KEY = process.env.GALAXY_KEY; | ||
} else { | ||
console.log("GALAXY_KEY not available. Please provide as environment variable to access a remote Galaxy instance."); | ||
} | ||
|
||
// https://vitejs.dev/config/ | ||
export const viteConfigCharts = defineConfig({ | ||
build: { | ||
outDir: "./static/dist", | ||
emptyOutDir: true, | ||
rollupOptions: { | ||
output: { | ||
manualChunks: () => "app.js", | ||
entryFileNames: "[name].js", | ||
chunkFileNames: "[name].js", | ||
assetFileNames: "[name][extname]", | ||
}, | ||
}, | ||
}, | ||
define: { | ||
"process.env.credentials": JSON.stringify(GALAXY_KEY ? "omit" : "include"), | ||
}, | ||
resolve: { | ||
alias: { | ||
"@": "/src", | ||
}, | ||
}, | ||
server: { | ||
proxy: { | ||
"/api": { | ||
changeOrigin: true, | ||
rewrite: (path) => { | ||
if (GALAXY_KEY) { | ||
const separator = path.includes("?") ? "&" : "?"; | ||
return `${path}${separator}key=${GALAXY_KEY}`; | ||
} else { | ||
return path; | ||
} | ||
}, | ||
target: GALAXY_ROOT, | ||
}, | ||
}, | ||
}, | ||
}); |