IT이야기

index.html이 Javascript를 로드하지 않을 경우 Vue 앱을 실행하는 방법은?

cyworld 2022. 5. 26. 23:08
반응형

index.html이 Javascript를 로드하지 않을 경우 Vue 앱을 실행하는 방법은?

Vue에 대해 읽은 자료 중 Vue 애플리케이션이 어떻게 시작되었는지 설명하려고 시도한 자료는 없음.여기에는 public/index.html, src/main.js, src/App.vue의 세 가지 파일이 포함된다.vue cli 4.1.1로 만든 비계에는 다음과 같은 진입점이 있는 index.html이 포함되어 있다.

<!DOCTYPE html>
<html lang="en">
  <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>sample-vue-project</title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but sample-vue-project 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>

main.js 파일은 Vue App 자체를 생성하지만 index.html은 main.js를 로드하지 않는다.index.html을 두 번 클릭하면 빈 페이지가 표시되므로 앱을 실행하려면 다른 작업이 개입되어야 한다.index.html의 코멘트는 파일이 자동 주입될 것이라고 되어 있는데, 그 주입은 무엇인가?

Vue 출시 프로세스는 어디선가 문서화되었는가?

로컬로 개발할 때 Vue Cli에서 주입을 처리하는데, 이는 실행 명령과 같은 것이 될 것이기 때문이다.npm run serve기본 구성의 경우

생산에 코드를 투입하면 다른 명령을 실행하게 될 것이다.npm run buildindex.properties 파일이 모든 javascript 코드를 참조하는 스크립트 태그를 포함하는 새로운 파일 집합을 만들 것이다.후드 아래에서 웹 팩을 사용하여 모든 자산 연결을 한다.

자세한 내용은 Vue Cli 웹 사이트를 참조하십시오.

참조URL: https://stackoverflow.com/questions/59632463/how-does-a-vue-app-get-launched-if-the-index-html-doesnt-load-any-javascript

반응형