vue3、vite和vue-router@next,无法解析组件router-view

vue3, vite and vue-router@next, cannot resolve component router-view

我用Vite创建了一个项目,添加了vue-router@next。我正在使用 main.js 内部的路由器,因为我浏览了一下,似乎这就是问题所在,但它并没有解决我遇到的问题。

// package.json
{
  "name": "rng-alpha",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview"
  },
  "dependencies": {
    "vue": "^3.0.5",
    "vue-router": "^4.0.5"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^1.1.5",
    "@vue/compiler-sfc": "^3.0.7",
    "vite": "^2.0.5"
  }
}

// main.js
import { createApp } from 'vue';
import App from './App.vue';
import router from './router/router';

const app = createApp(App);
app.use(router);
app.mount('#app');

// router.js
import {
  createWebHistory,
  createRouter
} from 'vue-router'

import Home from '../components/Home.vue'

const routes = [{
  path: "/",
  name: "Home",
  component: Home
}]

const router = createRouter[{
  history: createWebHistory,
  routes,
}]

export default router

// App.vue
<template>
  <div>
    <div>hi</div>
    <router-view />
  </div>
</template>

我收到的警告如下:

如何使路由器视图工作?由于我现在无法使用它。

createRouter 是一种应该使用 () 而不是 [] 调用的方法:

const router = createRouter({
  history: createWebHistory,
  routes,
})