Operation error:

 ERROR  ValidationError: webpack Dev Server Invalid Options
options should NOT have additional properties
ValidationError: webpack Dev Server Invalid Options
Copy the code

Baidu has tried many methods for a long time… Finally, it was found that it was Proxy in vue. Config. js file, P is capitalized, should be lowercase, JS is case-sensitive. options should NOT have additional properties

How do you differentiate the environment on the front end

$process.env.node_env; $process.env.node_env

2. Environment files: we can define VUE_APP_BASE_API in.env.development and.env.production files

Cross-domain problem

The cross-domain problem is caused by the same origin policy (inconsistent domain name port protocol) of the browser. Cross-domain is divided into development environment cross-domain (development) and production environment cross-domain (live). Our front-end focuses on cross-domain development environment issues. In today’s hr project, I used the proxy approach to solve cross-domain problems. (VUe-a service locally enabled by the CLI through which proxy requests can be made)

Exports = {devServer: {// exports: {// exports: {// exports: {// exports: {// exports: {// exports: { // localhost:8888/ API/ABC => proxy to another server // local front end = "local back end =" proxy we send requests to another server '/ API ': {target: 'www.baidu.com', // the address of the agent we want changeOrigin: True, // Does this need to be set to true to allow local service proxies across domains? {// reroute localhost:8888/ API /login => www.baidu.com/api/login '^/ API ': '// Suppose we want to change localhost:8888/ API /login to www.baidu.com/login}},}}}Copy the code