Vue 3.0 + Github Page

황검명·2021년 3월 30일
1

Github 페이지를 이용해서 Vue3.0 배포하는 방법

  1. vue 글로벌 설치 및 노드 설치

  2. vue 설치
    $ vue create ${project_name}

  3. git repository 설정 (public, 레포지토리 이름은 project_name 으로 설정)

  4. git remote 와 연결
    $ git init
    $ git add README.md
    $ git commit -m ":tada: First Commit"
    $ git remote add origin https://github.com/`${user_name}`/`${project_name}`.git
    $ git push -u origin master

  5. Root 폴더에 vue.config.js 만들어 줌
    $ touch vue.config.js

  6. vue.config.js 에 publicPath, outputDir 설정

module.exports = {    
 publicPath: process.env.NODE_ENV === 'production'
   ? '/`${project_name}`/'
   : '/',
  outputDir: 'docs',
}
  1. github repository -> settings -> GitHub Pages -> Source를 master/ docs 로 변경후 save

  2. $ npm run build

  3. $ git add . / git commit -m "${commit_contents}" / git push

  4. ${user_name}.github.io/${project_name}/ 에서 App.js 확인 가능

profile
Front End Engineer at Contents Wavve

0개의 댓글