webpack-contrib / webpack-hot-middleware

Webpack hot reloading you can attach to your own server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use latest 2.23.0: TypeError: Cannot read property 'name' of undefined

hubcarl opened this issue · comments

commented
  • Operating System: Mac
  • Node Version: 8.9.1
  • NPM Version: 6.3.0
  • webpack Version: 4.17.1
  • ${package} Version:

Expected Behavior

Actual Behavior

image

Use latest 2.23.0 version error, Use 2.22.0 version can run normally

How Do We Reproduce?

git clone https://github.com/hubcarl/egg-vue-webpack-boilerplate.git
yarn install
npm run dev

@okcoker this looks to be caused by the recent update, any ideas?

I've published a naive fix as v2.23.1 - keeping track of webpack's stats object across versions and configurations is always a pain.

it is not working

Are you getting the same error?

Router.js:37 Uncaught (in promise) TypeError: Cannot read property 'router' of undefined
    at ProxyComponent.getChildContext (Router.js:37)
    at ProxyComponent.getChildContext (react-hot-loader.development.js:580)
    at react-tree-walker.js:204
    at new Promise (<anonymous>)
    at recursive (react-tree-walker.js:135)
    at react-tree-walker.js:153

I updated deps and started to see this error.

That stack trace doesn’t seem to have anything to do with this module.

I will let you know soon. I am trying to fix it somehow

@glenjamin your change is probably the exact change I would have made. Thanks for that.

My blind guess is it might have to do something with the stats object of a single vs multi compiler setup?

That compilation object doesn’t seem to be documented. How did you find it in the first place?

it was related to another package. you can close it. thanks

@glenjamin I just found it myself. I noticed name stats name wasn't being output but I had access to a compilation object with a name on it. I figured it was a small change to get more context about what was updated 🙈

There's documentation on it though. You can even hook into it.

https://webpack.js.org/api/plugins/

Every step of the way, the plugin will have full access to the compiler and, when applicable, the current compilation.