首页 文章

使用vue项目部署到github页面的问题

提问于
浏览
2

我正在尝试将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/

设置 - >源 - > master / docs在存储库的根目录中有一个/ docs文件夹,不遵循存储库命名方案username.github.io或orgname.github.io

这是我的存储库:https://github.com/leewei05/blog

但结果一直给我404,还不知道我的问题是什么,请帮忙!

1 回答

  • 4

    原来我的配置路径错误,这里是将新的vue-cli项目部署到git hub页面的步骤 .

    (你必须先安装npm和vue-cli)

    • $ vue init webpack [projectName]

    • $ cd [projectName]

    • $ npm安装

    • 转到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运行构建

    • 将其推送到您的github存储库

    • 转到存储库中的设置

    • 找到您的GitHub页面部分并从'master'更改源 - > 'master/docs'

    • 您的网页应该在'https://[userName].github.io/[repositoryName]/#/'

    • 祝你好运!

相关问题