Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot Reload Not Working #3173

Closed
chenweibo opened this issue Dec 22, 2018 · 19 comments
Closed

Hot Reload Not Working #3173

chenweibo opened this issue Dec 22, 2018 · 19 comments

Comments

@chenweibo
Copy link

Version

3.2.1

Reproduction link

https://github.com/chenweibo/vueCliDemo

Environment info

  System:
    OS: macOS 10.14.2
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 10.14.2 - /usr/local/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 64.0
    Safari: 12.0.2
  npmPackages:
    @vue/babel-preset-app:  3.2.0
    @vue/cli-overlay:  3.2.0
    @vue/cli-plugin-babel: ^3.2.0 => 3.2.0
    @vue/cli-plugin-eslint: ^3.2.0 => 3.2.1
    @vue/cli-service: ^3.2.0 => 3.2.0
    @vue/cli-shared-utils:  3.2.0
    @vue/component-compiler-utils:  2.3.1
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    babel-helper-vue-jsx-merge-props:  2.0.3
    babel-plugin-transform-vue-jsx:  4.0.1
    eslint-plugin-vue: ^5.0.0-0 => 5.0.0
    vue: ^2.5.17 => 2.5.21
    vue-eslint-parser:  2.0.3
    vue-hot-reload-api:  2.3.1
    vue-loader:  15.4.2
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.17 => 2.5.21
    vue-template-es2015-compiler:  1.6.0
  npmGlobalPackages:
    @vue/cli: 3.2.1

Steps to reproduce

使用npm 安装的vue-cli 正常选择默认模板生成 然后 启动服务 热更新已经默认不生生效了 重现的模板在github 地址

What is expected?

希望正常能热更新 安装过很多版本的node.js 版本 都是不行 包括文档推荐的node.js 版本

What is actually happening?

不能热更新


WAIT Compiling...6:11:27 PM

10% building 0/1 modules 1 active ...dex.js??ref--13-0!/web/demo/src/App.vue DONE Compiled successfully in 408ms6:11:28PM

WARN
Couldn't parse bundle asset "/web/demo/dist/app.9f3062b5c30ee5b7e896.hot-update.js".
Analyzer will use module sizes from stats file.

App running at:

控制台没报错。 但是VUE UI 这个报错。 直接提示这个热更新问题不行

@chenweibo
Copy link
Author

vue-cli 是通过 npm 安装。 没安装cnpm模块

@sodatea
Copy link
Member

sodatea commented Dec 22, 2018

Caused by webpack-dev-server 3.1.11.


Workaround 1:

// vue.config.js
module.exports = {
  devServer: {
    disableHostCheck: true
  }
}

Workaround 2:

If you are using yarn, you can lock its version by adding the following resolutions field to package.json.
如果用 yarn 的话,暂时可以在 package.json 里增加 resolutions 字段锁版本

"resolutions": {
  "webpack-dev-server": "3.1.10"
}

@chenweibo
Copy link
Author

是的 我测试了下老的项目 webpack-dev-server 3.0.rc.12 发现热更新 生效的 这是我再开发新项目 重新生成模板的时候遇到的。

@sodatea sodatea changed the title 最新的cli 无法热更新。控制台显示正常 但是VUE-Ui 警告不能加载hot.js Hot Reload Not Working Dec 24, 2018
@sodatea sodatea pinned this issue Dec 24, 2018
@liuhuaxia
Copy link

// vue.config.js
module.exports = {
devServer: {
disableHostCheck: true
}
}
这样设置是可以修复,但是vue ui启动控制台还是有警告,用npm启动没有警告

@sodatea
Copy link
Member

sodatea commented Dec 25, 2018

Should have been fixed with the latest release of webpack-dev-server v3.1.14

Please run rm -rf node_modules yarn.lock package-lock.json and reinstall the dependencies.

@sodatea sodatea closed this as completed Dec 25, 2018
@sodatea sodatea unpinned this issue Dec 25, 2018
@marcnewton
Copy link

Still having to downgrade to 3.1.10 even after clean install of everything and wiped cache.

@popcornkiller1088
Copy link

True, v3.1.14 is still no working at all.
I using npm-force-resolutions to solve this problem

@marszoolong
Copy link

webpack-dev-server@3.1.14, 热更新动作会发生,但没有实质效果,一个更改在后续更改触发的热更新里才能起效果。

@kanbekotori
Copy link

True, v3.1.14 is still no working at all.
I using npm-force-resolutions to solve this problem

Hello, how do you solve the problem? I put

"resolutions": {
    "webpack-dev-server": "3.1.10"
  }

in package.json file and follow this doc run

rm -r node_modules
npx npm-force-resolutions
npm install

But i still get 3.1.14 version.

$ npm ls webpack-dev-server
final-shop@0.1.0 /Users/jiangxingshang/Documents/workspace/WebStorm/final-shop
└─┬ @vue/cli-service@3.4.0
  └── webpack-dev-server@3.1.14 

@marcnewton
Copy link

marcnewton commented Feb 27, 2019

npm install webpack-dev-server@3.1.0 to install specific version.

@marcnewton
Copy link

I just ran npm install -g @vue/cli - that installed version 3.4.1 (again)
Then ran npm install webpack-dev-server@3.2.1

Everything is working as expected now.
I don't understand why this worked all of a sudden when a clean install previously installed the same versions. Perhaps a sub dependency has been updated in the last week... ?

@kanbekotori
Copy link

I update @vue/cli to version 3.4.1 still not work.

└─┬ @vue/cli-service@3.4.1
  └── webpack-dev-server@3.2.1 
 WARN                                                             
Couldn't parse bundle asset "/Users/jiangxingshang/Documents/workspace/WebStorm/final-shop/dist/app.bda800bdbb3808612f08.hot-update.js".
Analyzer will use module sizes from stats file.

@marszoolong
Copy link

marszoolong commented Feb 27, 2019

hot reload not working in keep-alive

Caused by webpack-dev-server 3.1.11.

Workaround 1:

// vue.config.js
module.exports = {
  devServer: {
    disableHostCheck: true
  }
}

Workaround 2:

If you are using yarn, you can lock its version by adding the following resolutions field to package.json.
如果用 yarn 的话,暂时可以在 package.json 里增加 resolutions 字段锁版本

"resolutions": {
  "webpack-dev-server": "3.1.10"
}

Workaround 1 is working.
BUT when the <view-router /> is wrapped in a <keep-alive /> tag will make hot-reload no working too.

@kanbekotori
Copy link

I am not using keep-alive tag and in vue.config.js also has

devServer: {
    disableHostCheck: true
}

still not work for me.
I try to use yarn to install with

"resolutions": {
  "webpack-dev-server": "3.1.10"
}

Also not work. Crazy...

@marszoolong
Copy link

I am not using keep-alive tag and in vue.config.js also has

devServer: {
    disableHostCheck: true
}

still not work for me.
I try to use yarn to install with

"resolutions": {
  "webpack-dev-server": "3.1.10"
}

Also not work. Crazy...

my success case:
1- remove <keep-alive>
2- add disableHostCheck to devServer (must to do)
3- use default versoin (3.1.14) of webpack-dev-server

@zhoupeihuang
Copy link

devServer: {
// 热更新 打开
hotOnly: true,

@WangXi01
Copy link

WangXi01 commented Jun 3, 2019

devServer: {
// 热更新 打开
hotOnly: true,

现在好像不需要了,我的是关闭的也可以热更新

@cgfeel
Copy link

cgfeel commented Jul 4, 2019

image
没用啊

@natedunn
Copy link

natedunn commented Jul 7, 2019

Doesn't seem to be related directly to Vue?

I don't see gzip or parsed sizes, it only shows stat size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests