在webpack.dev.conf.js中添加:disableHostCheck: true
devServer: {
public: 'local.kingsum.biz',
clientLogLevel: 'warning',
historyApiFallback: true,
hot: true,
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
},
disableHostCheck: true 加上这段
}
祝工作顺利,身体健康
本文介绍如何在Webpack配置文件中设置disableHostCheck为true,实现跨域开发,同时详细展示了devServer的各项配置参数,包括public路径、日志级别、historyApiFallback、热更新、压缩、主机名、端口、代理等。

1万+

被折叠的 条评论
为什么被折叠?



