Vue 프로젝트 폴더 내부 살펴보기..

준영·2023년 10월 20일
0
post-thumbnail

package.json

{
  "name": "vue3-cli",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.8.3",
    "vue": "^3.2.13"
  },
  "devDependencies": {
    "@babel/core": "^7.12.16",
    "@babel/eslint-parser": "^7.12.16",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "eslint": "^7.32.0",
    "eslint-plugin-vue": "^8.0.3"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "@babel/eslint-parser"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead",
    "not ie 11"
  ]
}
  • script
    프로젝트와 연관 된 명령어들을 지정해서 쉽게 많은 타이핑 없이 동작을 수행 할 수 있도록 하는 명령어

  • dependencies
    프로젝트 라이브러리 관련 된 리스트

  • devDependencies
    프로젝트를 개발하기 위해서 필요한 부수적인 라이브러리 리스트

  • eslintConfig
    자바스크립트 문법 검사 도구

  • browserslist
    브라우저 호환성 관련 설정

vue.config.js

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true
})

vue-cli 서비스 관련된 내용들이 기본적으로 들어가 있고, 이후 웹팩에 대한 설정을 바꾼다던지의 사항을 이곳에서 추가적으로 설정 할 수 있다.

vue-cli api 문서

public/index.html

<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title><%= htmlWebpackPlugin.options.title %></title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>

이 파일의 내용들이 바로 화면에 표시되는 껍데기라고 생각하면 된다. (cli로 빌드 된 결과물)
한마디로 이 애플리케이션의 진입점이라고 생각하면 될 것 같다. <= Vue에서 작성한 컴포넌트의 코드의 결과물이 div태그 안에 붙는다.

src/main.js

import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')

위의 index.html의 create app이라고 하는 인스턴스를 만들고 그 인스턴스를 붙이는 영역까지의 코드가 이곳에 등록되어있다.

profile
개인 이력, 포폴 관리 및 기술 블로그 사이트 👉 https://aimzero-web.vercel.app/

0개의 댓글