Vue打包部署到Tomcat

一,在config-->index.js中,设置build更改 assetsPublicPath:  '/'为assetsPublicPath: './'

module.exports = {dev: {// PathsassetsSubDirectory: 'static',assetsPublicPath: './',proxyTable: {},// Various Dev Server settingshost: 'localhost', // can be overwritten by process.env.HOSTport: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determinedautoOpenBrowser: false,errorOverlay: true,notifyOnErrors: true,poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-// Use Eslint Loader?// If true, your code will be linted during bundling and// linting errors and warnings will be shown in the console.useEslint: true,// If true, eslint errors and warnings will also be shown in the error overlay// in the browser.showEslintErrorsInOverlay: false,/*** Source Maps*/// https://webpack.js.org/configuration/devtool/#developmentdevtool: 'cheap-module-eval-source-map',// If you have problems debugging vue-files in devtools,// set this to false - it *may* help// https://vue-loader.vuejs.org/en/options.html#cachebustingcacheBusting: true,cssSourceMap: true},build: {// Template for index.htmlindex: path.resolve(__dirname, '../dist/index.html'),// PathsassetsRoot: path.resolve(__dirname, '../dist'),assetsSubDirectory: 'static',assetsPublicPath: './',/*** Source Maps*/productionSourceMap: true,// https://webpack.js.org/configuration/devtool/#productiondevtool: '#source-map',// Gzip off by default as many popular static hosts such as// Surge or Netlify already gzip all static assets for you.// Before setting to `true`, make sure to:// npm install --save-dev compression-webpack-pluginproductionGzip: false,productionGzipExtensions: ['js', 'css'],// Run the build command with an extra argument to// View the bundle analyzer report after build finishes:// `npm run build --report`// Set to `true` or `false` to always turn it on or offbundleAnalyzerReport: process.env.npm_config_report}
}

二、在路由表里设置访问项目的根路径:

export default new Router({mode: 'history',base: '/eshop/', // 打包项目根目录routes: constantRouterMap
})

三、打包到dist目录下:

npm run build

四、拷贝dist目录下所有文件到tomcat--> webapps下,并重命名文件夹为base中的‘eshop’,启动tomcat即可

五、在浏览器中输入服务端地址:[ip]:[port]/eshop

来来来给我一分钱,我将给你更多优质博文~

Vue打包部署到Tomcat相关推荐

  1. vue 打包部署到tomcat

    http://192.168.3.78:8080/dist/index.html#/home  运行链接 D:\chenInstall\apache-tomcat-8.0.50\webapps\ROO ...

  2. php项目webpack打包,Vue项目webpack打包部署时Tomcat刷新报404错误问题如何处理

    这次给大家带来Vue项目webpack打包部署时Tomcat刷新报404错误问题如何处理,Vue项目webpack打包部署时Tomcat刷新报404错误问题处理的注意事项有哪些,下面就是实战案例,一起 ...

  3. vue项目打包部署到tomcat(详细)

    hash路由模式打包部署到tomcat 1.修改config/index.js文件下的assetsPublicPath为'./' 2.修改router文件夹下index.js添加 base: '/文件 ...

  4. SpringBoot + Vue打包部署到本地和远程服务器

    最近碰到有人问如何将SpringBoot和Vue进行打包部署到Tomcat服务器,由于Vue接触不是很久所以我自己也感兴趣是如何打包部署到本地或者远程服务器上(云端).恰好手上也有一个案例需要部署到远 ...

  5. vue打包放到java中启动_Springboot+Vue打包部署总结

    文章目录 一.Vue打包+部署 1. 打包(npm run build:prod) 2.nginx部署前端vue项目 二.Springboot打包+部署 1.打包(mvn clean package) ...

  6. vue 打包部署在 nginx服务中,以及出现的一些问题

    首先来说操作步骤 前提: 1.你已经安装/下载好 nginx 2.你的vue 项目已经打包完成,并得到了 dist 文件夹 部署开始: 1.vue 项目打包,在控制台输入 npm run build ...

  7. vue 打包路由报错_急急急急,vue打包部署后,路由无法跳转

    求助 vue打包部署后首页可以正常访问,可是一但点击下一步:就没反应:控制台报错: (打包后的index.html文件和JS文件分别部署在服务器的不同文件夹下,但是在index.html文件中的lin ...

  8. Vue打包部署IIS无法请求

    ARRv3_0 下载安装URl重写URL Rewrite 第一步安装,IIS配置,打开 第二步,点击 Server Proxy Settings 第三步,选中 应用 Vue打包部署 配置URL重写规则 ...

  9. Vue打包部署到服务器-找不到静态资源404错误

    Vue打包部署到服务器-找不到静态资源404错误 参考:https://blog.csdn.net/AnnaF/article/details/105709569 问题描述 在本地运行正常,但是使用n ...

最新文章

  1. C#对Excel的样式操作
  2. linux释放内存命令
  3. 检查字典中是否已存在给定键
  4. 关于for循环与setTimeout的延迟
  5. ap计算机科学换学分,科普:AP成绩出来了 换学分最全指南就在这
  6. 阿里云的云虚拟主机安装dede提示数据库连接失败的解决办法
  7. g77,g95,gfortran的关系
  8. windows下获取IP和MAC地址
  9. tcp拥塞控制_面试必备TCP(四):拥塞控制
  10. 吴恩达机器学习 9.机器学习系统设计
  11. 使用listen()和accept()函数
  12. prd移动端通用产品需求文档+Axure高保真app社交餐饮通用prd文档+产品业务说明+通用prd文档+通用prd模板+全局说明+需求分析+竞品分析+产品结构图+产品业务流程图+产品信息图+餐饮系统
  13. Windows NT 下载
  14. 国内测试看Netflix
  15. Invalid bound statement (not found) 五种解决方法
  16. Sechunter移动应用隐私合规检测详解
  17. [编程题]雀魂启动! C++
  18. 员工转正申请书_试用期员工转正申请书范文5篇
  19. 【 SAP消息号BS013】
  20. FT232RL FTDIUSB转串口芯片SSOP28 国产替代

热门文章

  1. 2008服务器看不见无线图标,Win7系统无线网络图标消失不见两种解决方法
  2. 使用umi4+qiankun 搭建微前端项目
  3. android gps时间格式,android gps 数据传输流程
  4. Javacv实现QSV硬件解码
  5. 大数据总线(DataHub)
  6. php数组的联合,PHP 数组合并
  7. PHP数组合并 array_merge
  8. 一个研究魔兽世界的网站
  9. 制作基于RTL8367实现8+2POE千兆交换机
  10. 快照问题site快照和点击百度快照显示的不一样 这是什么原因