3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

fix: webpack dev server + index fallback for prod serve.js

This commit is contained in:
Dragory 2024-03-30 13:33:29 +00:00
parent c89c5ea430
commit 3cad4d319e
No known key found for this signature in database
6 changed files with 22 additions and 7 deletions

View file

@ -4,6 +4,11 @@ const path = require("path");
fastify.register(fastifyStatic, { fastify.register(fastifyStatic, {
root: path.join(__dirname, "dist"), root: path.join(__dirname, "dist"),
wildcard: false,
});
fastify.get("*", (req, reply) => {
reply.sendFile("index.html");
}); });
fastify.listen({ port: 3002, host: '0.0.0.0' }, (err, address) => { fastify.listen({ port: 3002, host: '0.0.0.0' }, (err, address) => {

View file

@ -4,7 +4,7 @@
<nav class="flex items-stretch flex-wrap pl-4 pr-2 py-1 border border-gray-700 rounded bg-gray-800 shadow-xl mb-8"> <nav class="flex items-stretch flex-wrap pl-4 pr-2 py-1 border border-gray-700 rounded bg-gray-800 shadow-xl mb-8">
<div class="flex-full md:flex-initial flex items-center"> <div class="flex-full md:flex-initial flex items-center">
<img class="w-10 mr-5" src="../../img/logo.png" alt="" aria-hidden="true"> <img class="w-10 mr-5" :src="logoUrl" alt="" aria-hidden="true">
<router-link to="/dashboard"> <router-link to="/dashboard">
<h1 class="font-semibold">Zeppelin Dashboard</h1> <h1 class="font-semibold">Zeppelin Dashboard</h1>
@ -48,6 +48,7 @@
<script> <script>
import Title from "../Title.vue"; import Title from "../Title.vue";
import logoUrl from "../../img/logo.png";
export default { export default {
components: { components: {
@ -59,5 +60,8 @@
window.location.pathname = '/'; window.location.pathname = '/';
} }
}, },
data() {
return { logoUrl };
},
}; };
</script> </script>

View file

@ -5,7 +5,7 @@
<!-- Top bar --> <!-- Top bar -->
<nav class="flex items-stretch pl-4 pr-2 py-1 border border-gray-700 rounded bg-gray-800 shadow-xl"> <nav class="flex items-stretch pl-4 pr-2 py-1 border border-gray-700 rounded bg-gray-800 shadow-xl">
<div class="flex-initial flex items-center"> <div class="flex-initial flex items-center">
<img class="flex-auto w-10 mr-5" src="../../img/logo.png" alt="" aria-hidden="true"> <img class="flex-auto w-10 mr-5" :src="logoUrl" alt="" aria-hidden="true">
<router-link to="/docs"> <router-link to="/docs">
<h1 class="flex-auto font-semibold">Zeppelin Documentation</h1> <h1 class="flex-auto font-semibold">Zeppelin Documentation</h1>
@ -50,10 +50,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from "vue";
import {mapState} from "vuex"; import {mapState} from "vuex";
import Menu from 'vue-material-design-icons/Menu.vue'; import Menu from 'vue-material-design-icons/Menu.vue';
import Title from "../Title.vue"; import Title from "../Title.vue";
import logoUrl from "../../img/logo.png";
type TMenuItem = { type TMenuItem = {
to: string; to: string;
@ -131,7 +131,8 @@
data() { data() {
return { return {
mobileMenuOpen: false mobileMenuOpen: false,
logoUrl,
}; };
}, },

View file

@ -2,3 +2,8 @@ declare module "*.vue" {
import Vue from "vue"; import Vue from "vue";
export default Vue; export default Vue;
} }
declare module "*.png" {
const value: string;
export default value;
}

View file

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"moduleResolution": "node", "moduleResolution": "bundler",
"module": "esnext", "module": "esnext",
"target": "es2018", "target": "es2018",
"sourceMap": true, "sourceMap": true,
@ -15,7 +15,7 @@
"esModuleInterop": true, "esModuleInterop": true,
"allowJs": true "allowJs": true
}, },
"include": ["src/**/*.ts"], "include": ["src/**/*.ts", "src/**/*.vue", "./ts-vue-shim.d.ts"],
"references": [ "references": [
{ {
"path": "../shared/tsconfig.json" "path": "../shared/tsconfig.json"

View file

@ -173,7 +173,7 @@ if (process.env.NODE_ENV === "production") {
mode: "development", mode: "development",
devtool: "eval", devtool: "eval",
devServer: { devServer: {
...(process.env.DEV_HOST ? { host: process.env.DEV_HOST } : undefined), allowedHosts: "all",
historyApiFallback: true, historyApiFallback: true,
port: 3002, port: 3002,
}, },