Skip to content

[StackOverflow] Uncaught RangeError: Maximum call stack size exceeded #136

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

Closed
pksjce opened this issue Sep 7, 2016 · 10 comments
Closed
Labels

Comments

@pksjce
Copy link

pksjce commented Sep 7, 2016

From @despairblue on November 3, 2015 19:39

Uncaught RangeError: Maximum call stack size exceeded
  hotAddUpdateChunk @ bundle.js:736
  webpackHotUpdateCallback @bundle.js:5
  webpackHotUpdateCallback @ bundle.js:6
  webpackHotUpdateCallback @ bundle.js:6
  webpackHotUpdateCallback @ bundle.js:6
  webpackHotUpdateCallback @ bundle.js:6
  webpackHotUpdateCallback @ bundle.js:6
  webpackHotUpdateCallback @ bundle.js:6
  webpackHotUpdateCallback @ bundle.js:6
  webpackHotUpdateCallback @ bundle.js:6

What happens is that after a successful hot reload, webpackHotUpdateCallback keeps calling hotAddUpdateChunk which returns immediately since hotAvailibleFilesMap[0] === true but hostRequestedFilesMap[0] === false.

I also can't find a place where parentHotUpdateCallback is unset, so I don't see how this circle could ever be broken? Is this used for polling? Then a setTimeout could at least reset the stack.

But maybe I'm missing something here.

Thanks for working on this and making things like hot module replacement possible!

Copied from original issue: webpack/webpack#1583

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @despairblue on November 3, 2015 23:1

This happens when starting the dev server with --hot and also having webpack/hot/only-dev-server' in your entry array in webpack.config.js. Then the hot loading snippet is sourced twice creating this ping pong effect that keeps calling those two functions.

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @despairblue on November 3, 2015 23:6

This also leads to things like:

if (module.hot) {
  module.hot.accept('./App', function () {
    require('./App')
  })
}

compiling into:

if (true) {
  module.hot.accept(230230, function () {
    __webpack_require__(230);
  });
}

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @despairblue on November 3, 2015 23:15

Only using one of them does also not work.

If only using --hot then the accept callbacks are never called. And only using the webpack/hot/only-dev-server entry point without --hot makes the dev server refresh the browser on every change instead of hot swapping the modules.

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @despairblue on November 3, 2015 23:30

Ok I found a combination that worked:

  1. use the webpack-dev-server with --hot
  2. do use the entry point webpack/hot/only-dev-server (with or w/o only) in the config
  3. DO NOT add new webpack.HotModuleReplacementPlugin() to the config's plugin section

Is this intended behaviour? If yes, should there be something in the documentation warning about this? If no, should there be some guards catching these cases?

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @damionvega on March 3, 2016 23:30

We're using npm scripts to run webpack and came across the same problem. This is very confusing. Thanks @despairblue

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @imrvelj on April 30, 2016 14:43

Happens to me also. Thanks @despairblue for the quick fix.

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @Delagen on June 9, 2016 8:7

+1

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @theoutlander on August 2, 2016 3:28

@despairblue Thanks for the detailed follow-up and solution!

@SpaceK33z
Copy link
Member

Side note, we are working on better config validation in webpack-dev-server that should prevent issues like this: webpack/webpack-dev-server#615.

@bebraw
Copy link
Contributor

bebraw commented Oct 3, 2016

Yeah, closing. Thanks.

@bebraw bebraw closed this as completed Oct 3, 2016
hzuhyb pushed a commit to hzuhyb/webpack.js.org that referenced this issue Feb 18, 2017
/content/concepts/entry-points.md 校对
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants