[Problem solving] Cloud server access to the vue project file configuration settings

Problem statement

If we want the vue project support code to run on the server, we need to modify the basic project configuration before uploading the file to the server, that is, some basic settings such as webpack

solution

In the config directory, change the target in index.js to the intranet ip (such as 172.21.0.14), and the host to 0.0.0.0

​    proxyTable: {
    
    '/api': {
    
    
​        target: 'http://172.21.0.14:8080',
​        pathRewrite: {
    
    '^/api': '/static/mock'}}},

​    // Various Dev Server settings
​    host: '0.0.0.0', // can be overwritten by process.env.HOST

Guess you like

Origin blog.csdn.net/weixin_44704985/article/details/113946044