My composer json script for hot:
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
After updating laravel mix, hot reload stoped working. Scripts cannot be loaded, and when I visit http://localhost:8080/ or http://localhost:8080/js/app.js I get message: Cannot get / or Cannot get /js/app.js
Nothing else was changed and npm run dev still works.
If I use the fix that was posted in https://github.com/JeffreyWay/laravel-mix/issues/599 I can get it to work, but I need to disable extract because they suffer from the same error of Cannot GET /js/manifest.js.
Was there a breaking change and docs don't reflect it?
Having the same problem. From what I have gathered it's a webpack problem. Sadly would not know where to start to try and fix it.
It seems to be a webpack-dev-server issue. I suddenly started getting No Access-Control-Allow-Origin header is present when hot-reload is triggered.
I noticed that a lot of recent problems with this package are being caused by webpack being a dependency, maybe you should specify exact versions in package.json for some of its webpack dependencies. If that's too extreme maybe just change ^ to ~. The dependency versions are too loose.
It's because of security fix in webpack-dev-server 2.4.3. More information - https://github.com/webpack/webpack-dev-server/releases/tag/v2.4.3
I added the headers option to the following in setup/webpack.config.js:
module.exports.devServer = {
historyApiFallback: true,
noInfo: true,
compress: true,
quiet: true,
headers: {
'Access-Control-Allow-Origin': '*'
}
};
This allows CORS requests from all hosts, which is ideal for Laravel Mix IMO (since it's designed to be portable with minimal config, and allow for dev environments with random local domains). However, this defeats the purpose of the aforementioned patch.
I'd be happy to submit a PR for this, however I'd like @JeffreyWay's thoughts first. Perhaps Mix's hot-reload functionality should require this config?
I had the same alert by CORS policy. Access-Control-Allow-Origin: '*' header in devServer solves the issue.
Same issue here.
Fixed: just changed "webpack-dev-server" in package.json to "2.4.2" without ^.
meh, it's not working again. don't know what is changes. get in touch.
I am on hackathon right now and it's very big trouble for me.
I just merged a PR to fix this.
Most helpful comment
I just merged a PR to fix this.