我设法让 webpack-dev-server 和 laravel valet 为该站点提供服务,并在同一网络中的移动设备上重定向到正确的路径。
但是它不会通过从内存提供的 js 注入 css。只有当我将 js/css 写入磁盘时它才会起作用,这不是最佳的。我相信移动设备上的 js 没有通过代理指向,但我不知道该怎么做。
非常感谢大家,非常感谢
entry: {
'app.bundle': './src/scripts/index.js',
},
cache: true,
output: {
filename: '[name].js',
publicPath: 'http://localhost:8080/',
chunkFilename: '[chunkhash].js',
},
.
.
.
devServer: {
hot: true,
inline: true,
overlay: false,
quiet: true,
host: '0.0.0.0',
proxy: {
'*': {
target: 'http://laravelapp.dev/',
changeOrigin: true,
},
},
disableHostCheck: true,
contentBase: path.resolve(__dirname, './src/templates'),
headers: {
'Access-Control-Allow-Origin': '*',
},
watchContentBase: true,
watchOptions: {
poll: false, // might be needed for homestead/vagrant setup, review
},
historyApiFallback: false,
noInfo: true,
},