본문 바로가기
프론트엔드/Vue.js

Netlify-CLI 구성

by step 1 2022. 1. 15.
반응형

공식문서 URL

Netlify CLI Command List

 

Netlify CLI Command List

Netlify CLI Command List Welcome to the Netlify CLI! This site provides online access to all help strings in the Netlify CLI. For a more in-depth guide, please see our Getting Started guide on our main docs site. If you have questions, ideas, or would like

cli.netlify.com

netlify-dev

 

x0

What is Netlify Dev? Watch the introduction (24 minutes) Netlify Dev brings the power of Netlify's Edge Logic layer, serverless functions and add-on ecosystem to your local machine. It runs Netlify's production routing engine in a local dev server to make

cli.netlify.com

 

netlify-cli 패키지 설치

명령어: npm i -D netlify-cli

 

package.json 파일 코드 수정

"scripts": {
    "dev": "webpack-dev-server --mode development",
    "dev:netlify": "netlify dev",
    "build": "webpack --mode production",
    "lint": "eslint --fix --ext .js,.vue"
  },

netlify.toml 코드 수정

# [functions]
#   directory = "functions"

# Netlify Dev
# https://cli.netlify.com/netlify-dev/#netlifytoml-dev-block

# 제품모드
[build]
  command = "npm run build"
  functions = "functions"       # Netlify 서버리스 함수가 작성된 디렉토리를 지정합니다.
  publish = "dist"              # 프로젝트 빌드 결과의 디렉토리를 지정합니다.

# 개발 모드
[dev]  
  framework = "#custom"         # 감지할 프로젝트 유형을 지정합니다. 앱 서버 및 'targetPort' 옵션을 실행하는 명령 옵션은 ''
  command = "npm run dev"       # 연결할 프로젝트의 개발 서버를 실행하는 명령(스크립트)을 지정합니다.
  targetPort = 8080             # 연결할 프로젝트 개발 서버의 포트를 지정합니다.
  port = 8888
  publish = "dist"              # 프로젝트의 정적 콘텐츠 디렉토리를 지정합니다.
  autoLaunch = false            # Netlify 서버가 준비되면 자동으로 브라우저를 오픈할 것인지 지정합니다.

 

netlify 개발 서버 오픈 명령어: npm run dev:netlify

브라우저 확인 URL: localhost:8888/.netlify/functions/hello

 

반응형