반응형
IIS에서 vuejs 파일을 실행하는 방법
따라서 requirejs-vue를 컴포넌트 로더로 사용하는 학습 목적의 데모로서 vueJs Example을 사용하고 있습니다.VS-code(단순한 http 서버)의 Live-Server 확장으로 서버를 실행하면 문제없이 정상적으로 동작합니다.단, Windows 8.1의 IIS 서버(버전 8.5)에서 이 예를 실행하면 404 Error 앱을 통해 실행됩니다.vue가 존재하지 않습니다.
Failed to load resource: the server responded with a status of 404 (Not Found)
Network devtool에서 *.vue 파일을 제외한 모든 모듈이 올바르게 로드되어 있는 것을 확인할 수 있습니다.
VueJ의 예:https://plnkr.co/edit/Y2cEa3?preview
사용 중인 IIS용 웹 구성: https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/500" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
PS: requirejs-vue 대신 http-vue-loader를 사용하는 다른 예도 실행했지만 IIS는 여전히 동일한 오류를 발생시킵니다.
마임을 설정해야 합니다.사용할 ".vue" 확장자 파일 입력httpvueloader
/requiresjs_vue
.
또한 수동으로 추가할 수도 있습니다.Web.Config
IIS에서 인식할 수 있는 파일입니다.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".vue" mimeType="application/javascript"/>
</staticContent>
</system.webServer>
</configuration>
문제가 아직 남아 있으면 언제든지 알려주세요.
언급URL : https://stackoverflow.com/questions/61935036/how-to-run-vuejs-files-on-iis
반응형
'programing' 카테고리의 다른 글
Vue JS 2 데이터에 대해 여러 계산된 속성 (0) | 2022.08.02 |
---|---|
Vuex - 저장 상태 개체가 알 수 없는 유형입니다. (0) | 2022.08.02 |
개발 중에 VUE-CLI에서 콘솔 로그 사용 방법 (0) | 2022.08.02 |
뚱뚱한 JAR이 뭐죠? (0) | 2022.08.02 |
정적 컨텍스트에서 비 정적 변수를 참조할 수 없습니다. (0) | 2022.08.02 |