サイトにサービスを提供する 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,
},
webpack.config のエントリを変更して動作しました。
entry: {
'app.bundle.js': [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./src/scripts/index.js',
],
},`
output: {
filename: '[name].js',
publicPath: '/',
chunkFilename: '[chunkhash].js',
},
.
.
.
devServer: {
hot: true,
inline: true,
host: '0.0.0.0',
proxy: {
'*': {
target: 'http://laravelapp.dev/',
changeOrigin: true,
},
},
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
watchContentBase: true,
historyApiFallback: false,
},
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加