前端发布项目

修改project.config.js文件中的proxyUrlimgUrl的地址,改为空

①    // proxyUrl: '/test',   //本地测试使用的,同时.webpackrc中的
②    // imgUrl:'/test',
③    // proxyUrl: 'http://58.240.86.44:59999',  //放在tomcat下使用的地址
    // imgUrl: 'http://58.240.86.44:59999',
    proxyUrl: '',
    imgUrl: '',

其中test是本地测试时使用,配合.webpackrc中的proxy

    "proxy": {
        "/test": {
            "target": "http://127.0.0.1:10002",
            //"target": "http://172.16.11.66:10003",
            "changeOrigin": true,
            "pathRewrite": {
                "^/test": ""
            }
        },
        "/weather": {
            "target": "https://www.sojson.com/open/api/weather/json.shtml",
            "changeOrigin": true,
            "pathRewrite": {
                "^/weather": ""
            }
        }
    },

其中http://58.240.86.44:59999是tomcat下使用的地址
③当时空的时候就是第三种发布方式,然后在前端输入npm run build,将得到的文件夹(比如文件夹名是dist)放入后台服务application-dev.yml配置文件spring.resource.static-locations定义的目录中,重启后台服务,在浏览器中输入:172.16.11.66:10003/dist/index.html

你可能感兴趣的:(前端发布项目)