svelte-navigator: TypeError: 无法读取 null 的属性(读取 'indexOf')



我是新人。我试图使客户端路由与苗条导航库,但我得到一个错误,当我试图构建它。

npm run dev
09:24:58 [vite-plugin-svelte] ssr compile in progress ...
TypeError: Cannot read properties of null (reading 'indexOf')

src/线路/+ layout.svelte

<script>
import Header from './Header.svelte';
import './styles.css';
import { Router, Route, Link } from "svelte-navigator";
</script>
<Router>
<div class="app">
<Header />
<main>
<Route path="/">
<h3>Home</h3>
<p>Home sweet home...</p>
</Route>

<Route path="about">
<h3>About</h3>
<p>That's what it's all about!</p>
</Route>
</main>
</div>
</Router>

svelte.config.js

import adapter from "@sveltejs/adapter-static";
export default {
kit: {
adapter: adapter({
// default options are shown. On some platforms
// these options are set automatically — see below
pages: "build",
assets: "build",
fallback: null,
precompress: false,
strict: true,
}),
},
};

我试着在谷歌上找到解决方案,问我的朋友程序员,但没有效果。

and

import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [sveltekit()],
optimizeDeps: { exclude: ["svelte-navigator"] },
});

相关内容

  • 没有找到相关文章

最新更新