vue-cli3项目编译配置Tomcat下运行

1. npm run build生成打包文件在项目dist目录中

2. 复制dist目录内内容至Tomcat服务器webapps/ROOT文件夹下(无ROOT文件夹则创建)

3. 在Tomcat conf文件下编辑web.xml,文件尾部添加:

    ...
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
    </welcome-file-list>
    <error-page>
        <error-code>404</error-code>
        <location>/index.html</location>
    </error-page>
</web-app>

4. 启动Tomcat, 浏览器输入localhost:8080即可访问

 

posted @ 2019-04-12 09:26  DONZ  阅读(1581)  评论(0编辑  收藏  举报