- Question: In the process of development with vue will be used
webpack-dev-server
to build a local staging server, if there is a resource script this time under a different domain wants to access webpack-dev-server will report the following跨域
error. - Solution: Open the
build/webpack.dev.conf.js
file and make the following changes:
devServer: {
//加一行header即可
headers:{'Access-Control-Allow-Origin':'*'}
}