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

Cannot set property 'webpackStats' of undefined #28

Closed
croissong opened this issue Feb 22, 2017 · 1 comment
Closed

Cannot set property 'webpackStats' of undefined #28

croissong opened this issue Feb 22, 2017 · 1 comment

Comments

@croissong
Copy link
Contributor

croissong commented Feb 22, 2017

Node version: 7.5.0
NPM version: 4.1.2
Koa version: 2.0.0-alpha.7
koa-webpack version: 0.3.0

Error output: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property 'webpackStats' of undefined

I'm getting this error when using the serverSideRender: true option in webpack-dev-middleware and a following middleware. I think it's caused by webpack-dev-middleware wanting to set res.locals.webpackStats here.
I believe the res object is created here and cannot be changed in between.

@shellscape
Copy link
Owner

there's some significant madness around that option here. given that that's the only place res.locals appears in the webpack-dev-middleware, we might have to assert that locals exists on our end. that could be a koa 1 vs. koa 2 thing. I'm open to a PR that resolves your use-case.

it's also wholly irresponsible of them not to check that res.locals exists to begin with, prior to assigning it. you may want to open an issue with that project describing as much as well.

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

No branches or pull requests

2 participants