Reputation: 655
My Vue HOT MODULE REPLACEMENT (HMR) not working. What I have and what I do:
composer install
and npm install
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"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",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"live": "cross-env NODE_ENV=development webpack-dev-server --open --hot"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.1.1",
"cross-env": "^5.2.0",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.10",
"popper.js": "^1.14.3",
"vue": "^2.5.7"
},
"dependencies": {
"ajv": "^6.5.1",
"bootstrap-datepicker": "^1.8.0",
"js-cookie": "^2.2.0",
"moment": "^2.22.2",
"vue-flatpickr-component": "^7.0.4",
"vue-router": "^3.0.1",
"vue-snotify": "^3.1.0",
"vuex": "^3.0.1"
}
}
<script src="{{ mix('js/app.js') }}"></script>
and when I opening page and look page code I see <script src="//localhost:8080//js/app.js"></script>
. When npm run hot
I can see my js if open localhost:8080//js/app.js
manualy from browser. I'm try write url manualy in template too - <script src="http://localhost:8080/js/bundle.js"></script>
. The same result.npm run hot
NOT runing netstat -ano | findstr 8080
in cmd clear - so, the 8080 port is not using. When npm run hot
is runing - 8080 is LISTENING.npm run hot
and reload page with appliccation in console no any messages like "HMR is running" and e.t.c.localhost:8080//js/app.js
in browser manualy too.My webpack.mix.js
in laravel root folder:
let mix = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js') .sass('resources/assets/sass/app.scss', 'public/css');
Step by step:
composer create-project --prefer-dist laravel/laravel blog
npm i
npm run dev
resources\views\welcome.blade.php
remove all between <body></body>
and add next (see on the bottom)http://blog/public/
. I can see 'Example Component'.npm run hot
and wait for compilingresources\assets\js\components\ExampleComponent.vue
add any symbol to html code in template and check chrome page - no any chages. Hard reload page - no any changes!Code for #4
<div id="app">
<example-component></example-component>
</div>
<script src="{{ mix('js/app.js') }}"></script>
Help my please!
Upvotes: 0
Views: 4624
Reputation: 20309
It seems the hot module replacement functionality is currently bugged. This is a temporary workaround but this does not solve issues like CSS reloading:
https://github.com/JeffreyWay/laravel-mix/issues/1483#issuecomment-366685986
We will have to wait for a proper fix.
Upvotes: 1