You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Svelte部署后默认Hello World残留问题求助

自定义域名部署后维护页面上方出现Svelte默认内容的问题

编辑: 经排查该问题仅出现在我的设备上,但仍希望得到相关原因解释,感谢帮助!

我正在为开发中的网站搭建维护页面,通过空白index.html页面跳转至维护页面,该逻辑本地运行正常。我使用Svelte框架以便后续开发,但部署后,新建Svelte项目时默认的Hello World内容始终显示在维护页面上方。

奇怪的是,该问题仅在部署后使用自定义域名时出现,本地静态页面、本地服务器运行及使用非自定义域名部署时均无此问题。我使用Cloudflare Pages部署站点,通过Cloudflare将GoDaddy注册的自定义域名指向该站点。相关代码配置如下:

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width,initial-scale=1'>

    <title>Book Planet UK</title>

    <link rel='icon' type='image/png' href='/favicon.png'>
    <link rel='stylesheet' href='/public/global.css'>
    <link rel='stylesheet' href='/build/bundle.css'>

    <script defer src='/build/bundle.js'></script>
</head>

<body>
    <script src="app.js"></script>
</body>
</html>

app.js

window.onload = function() {
    window.location.replace("under-construction/under-construction.html");
}

under-construction/under-construction.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width,initial-scale=1'>

    <title>Book Planet UK</title>

    <link rel='icon' type='image/png' href='/favicon.png'>
    <link rel='stylesheet' href='under-construction.css'>
    <link rel='stylesheet' href='/build/bundle.css'>

    <script defer src='/build/bundle.js'></script>
</head>

<body>
    <script src="under-construction.js"></script>
    <div class="overlay">
        <h1 class="title">Book Planet UK is currently undergoing development.</h1>
        <span class="title">We are hoping to be back by 2023, so hold tight until then! 🚀️</span>
        <br>
        <button onclick="location.href = '/public/staff/index.html';">Staff Login</button>
    </div>
</body>
</html>

under-construction/under-construction.css

@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');

* {
  background-image: url("https://webgradients.com/public/webgradients_png/008%20Rainy%20Ashville.png");
}

.title {
    background: transparent;
    font-family: 'Roboto', sans-serif;
    padding-top: 20px;
    padding-left: 5%;
    padding-right: 5%;
}

.overlay {
    background: rgba(240, 248, 255, 0.375);
    border-radius: 10px;
    padding-left: 5%;
    padding-right: 5%;
    width: auto;
    max-width: max-content;
    height: auto;
}

button {
    background: transparent;
    font-family: 'Roboto', sans-serif;
    width: 20%;
    height: 35px;
    color: #242024;
    border: 2px solid #242024;
    border-width: 2px;
    margin-left: 5%;
    align-items: center;
    border-radius: 3px;
    margin-top: 25px;
    margin-bottom: 25px;
    transition: 0.25s ease;
}

button:hover {
    transform: scale(1.05);
    cursor: pointer;
}

src/app.svelte

<script lang="ts">
</script>

<main>
</main>

<style>
</style>

非自定义域名部署地址:book-planet-uk.pages.dev;自定义域名:bookplanetuk.co.uk。我怀疑是本地设备问题,已重启电脑排查,若您访问域名时未出现该问题也请告知。

提前感谢您的帮助!


内容的提问来源于stack exchange,提问作者Lexicled

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 10:18:19