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

I got error on webpack-div-middleware #21

Open
vvkee opened this issue Jul 1, 2016 · 0 comments
Open

I got error on webpack-div-middleware #21

vvkee opened this issue Jul 1, 2016 · 0 comments

Comments

@vvkee
Copy link

vvkee commented Jul 1, 2016

TypeError: Cannot read property 'filename' of undefined
      at /Users/nico/node/react-koa2-server/node_modules/koa-react-view/index.js:152:36
      at Array.forEach (native)
      at cleanCache (/Users/nico/node/react-koa2-server/node_modules/koa-react-view/index.js:151:30)
      at Object.app.context.render (/Users/nico/node/react-koa2-server/node_modules/koa-react-view/index.js:85:9)
      at home.js:32:21
      at /Users/nico/node/react-koa2-server/node_modules/react-router/lib/match.js:65:5
      at /Users/nico/node/react-koa2-server/node_modules/react-router/lib/createTransitionManager.js:118:11
      at done (/Users/nico/node/react-koa2-server/node_modules/react-router/lib/AsyncUtils.js:79:19)
      at /Users/nico/node/react-koa2-server/node_modules/react-router/lib/AsyncUtils.js:85:7
      at getComponentsForRoute (/Users/nico/node/react-koa2-server/node_modules/react-router/lib/getComponents.js:15:5)
      at /Users/nico/node/react-koa2-server/node_modules/react-router/lib/getComponents.js:41:5
      at /Users/nico/node/react-koa2-server/node_modules/react-router/lib/AsyncUtils.js:84:5
      at Array.forEach (native)
      at mapAsync (/Users/nico/node/react-koa2-server/node_modules/react-router/lib/AsyncUtils.js:83:9)
      at getComponents (/Users/nico/node/react-koa2-server/node_modules/react-router/lib/getComponents.js:40:28)
      at finishEnterHooks (/Users/nico/node/react-koa2-server/node_modules/react-router/lib/createTransitionManager.js:112:35)

And I found the error in the code

function cleanCache(match) {
  Object.keys(require.cache).forEach(function(module) {
    if (match(require.cache[module].filename)) {
      delete require.cache[module];
    }
  });
}

It should be

function cleanCache(match) {
  Object.keys(require.cache).forEach(function(module) {
    if (require.cache[module] && require.cache[module].filename && match(require.cache[module].filename)) {
      delete require.cache[module];
    }
  });
}
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

1 participant