我想在'vue.js'上使用github页面
我试图修改/config/index.js
文件。
build: {
// Template for index.html
index: path.resolve(__dirname, '../docs/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../docs'),
assetsSubDirectory: 'static',
assetsPublicPath: '',
这应该起作用:“ Vue.js / Deployment / Platform Guides GitHub Pages/ ”文档只需添加:
[如果要部署到
https://<USERNAME>.github.io/<REPO>/
,(即,您的存储库位于https://github.com/<USERNAME>/<REPO>
),请将publicPath
设置为“/<REPO>/
”。例如,如果您的回购名称为“my-project
”,则您的vue.config.js
应如下所示:
module.exports = {
publicPath: process.env.NODE_ENV === 'production'
? '/my-project/'
: '/'
}
[toast38coza说明在他的blog post中进行的设置:
步骤1:设置要构建到
/docs
的构建系统>编辑:
config/index.js
find ../dist replace with ../docs change assetsPublicPath: '/', to: assetsPublicPath: './',
运行:
npm run build
您现在应该在项目中有一个docs文件夹。添加并推送到github