## 使用 Vite 构建项目

创建新项目
```
npm create vite@latest
```

进入项目目录
```
cd project-name
```

安装依赖
```
npm install
```

启动开发服务器
```
npm run dev
```

构建项目，如果项目完成开发并准备构建生产版本，可以运行以下命令：
```
npm run build
```
这个命令会在项目的 `dist/` 目录下生成生产环境的静态文件。


# Install the gh-pages node module

There is a tool out there that will make your life way easier for future deployments, and that is [gh-pages](https://www.npmjs.com/package/gh-pages).

Run the following command to install it:

```
npm install gh-pages --save-dev
```

Now in your `package.json` , add the following under the `scripts` param, both are needed!:

```
"scripts": {  
  ...  
  "predeploy": "npm run build",  
  "deploy": "gh-pages -d dist",  
  ...  
}
```

修改`vite.config`为：

```
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vite.dev/config/
export default defineConfig({
  base: '/Github仓库名/',
  plugins: [vue()],
})
```

```
base: '/仓库名/',
```

如果自定义域名，在自定义域名的根目录下访问，则为：

```
base: '/',
```

并且要将 `CNAME` 文件放入 `public` 文件夹。

Then all you need to do to deploy your app to GitHub pages is run the command:

```
npm run deploy
```