我正在尝试将 vue-cli 项目部署到 github 页面,我按照本网站和 github 支持上的说明进行操作。
delpoy vue-cli 到 github 页面: https://medium.com/@mwolfhoffman/deploying-to-github-pages-with-vue-webpack-cli-5b2ba17f14a0
配置github页面 https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/
Setting -> source -> master /docs
have a /docs folder in the root of the repository
not follow the repository naming scheme username.github.io or orgname.github.io
这是我的存储库:https://github.com/leewei05/blog
但是结果一直给我404,还是不知道我的问题是什么,求助!
最佳答案
原来我的配置路径错误,这里是将新的 vue-cli 项目部署到 git hub 页面的步骤。
(你得先安装npm和vue-cli)
$ vue init webpack [项目名称]
$ cd [项目名称]
$ npm install
- 转到您的 config/index.js 文件
- 像这样修改构建部分:
build: {
index: path.resolve(__dirname, '../docs/index.html'),
assetsRoot: path.resolve(__dirname, '../docs'),
assetsSubDirectory: 'static',
assetsPublicPath: '',
productionSourceMap: true,
devtool: '#source-map',
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
bundleAnalyzerReport: process.env.npm_config_report
}
$ npm run build
- 将其推送到您的 github 存储库
- 转到存储库中的设置
- 找到您的 GitHub 页面部分并将来源更改为 '大师' -> '大师/文档'
- 你的页面应该在
https://[userName].github.io/[repositoryName]/#/
- 祝你好运!
关于git - 使用vue项目部署到github页面的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47615863/