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

Error: Aborted because ... is not accepted #70

Closed
bayov opened this issue Feb 6, 2016 · 16 comments
Closed

Error: Aborted because ... is not accepted #70

bayov opened this issue Feb 6, 2016 · 16 comments

Comments

@bayov
Copy link

bayov commented Feb 6, 2016

When trying to hot-update React components with webpack-hot-middleware, I receive the following error every time:

Uncaught (in promise) Error: Aborted because ./SomeComponent.js is not accepted

I'm not exactly sure why that happens... But I've noticed that:

I can hot-update anything else (manually replacing my redux-reducer using module.hot.accept, reload css using style-loader, etc.).

Stepping through with the debugger, I can see that in file process-update.js line 32, The callback function given to module.hot.check is never called. It seems the hotCheck() function assigns its apply parameter (the callback) to a global hotApplyOnUpdate. This function is then given to hotApply() which expects to receive an options object, and not a callback.

Searching for all usages of hotApplyOnUpdate yields:

  • Initially defined as true;
  • Assigned to be the given apply parameter every time hotCheck() is called.
  • Given as an argument to hotApply() inside hotUpdateDownloaded().

So, is it a problem with webpack's HMR plugin?


I'm using:

webpack@2.0.5-beta
webpack-dev-middleware@1.5.1
webpack-hot-middleware@2.6.4
@glenjamin
Copy link
Collaborator

"Not Accepted" errors are almost always because of a mistake or bug in the apply() code/handler.

Do you see the same issue on webpack v1? 2.0 is pretty new - I don't know whether the HMR code has changed much, but it could be related.

@bayov
Copy link
Author

bayov commented Feb 6, 2016

Update:
The issue doesn't appear when using webpack@1.12.13.

But there are two small issues which I'm not sure are even solvable:

  • Cannot hot-reload React stateless functional components.
  • Cannot hot-reload components provided to my router (page components). Sometimes HMR logs that the component was successfully updated but it isn't really updated, and sometimes I receive a warning for the same component:
[HMR] The following modules couldn't be hot updated: (Full reload needed)
This is usually because the modules which have changed (and their parents) do not know how to hot reload themselves. See http://webpack.github.io/docs/hot-module-replacement-with-webpack.html for more details.

@glenjamin
Copy link
Collaborator

How much do you need the v2 changes? Sounds like it might be best to stay on v1 for now if you're pressed for time to deal with such issues.

@bayov
Copy link
Author

bayov commented Feb 6, 2016

Yeah, I've now already gone back to webpack v1. I'll upgrade when it is a bit more stable. Thank you!

@phaistonian
Copy link

Any news on this one?

@glenjamin
Copy link
Collaborator

I've not had a chance to look into any of the webpack 2 stuff yet.

Any help is appreciated.

@rmarscher
Copy link
Contributor

As @SosZ uncovered, the signature for module.hot.check has changed in webpack 2 to using promises instead of a callback. The new version of only-dev-server.js uses then() and catch() instead of a callback. I think it's possible to support both the webpack 1 callback and the webpack 2 promise. I submitted pull request #85. Hope that helps.

@glenjamin
Copy link
Collaborator

Keeping the issue open until the fix is confirmed. If anyone is able test the master branch and feed back that'd be great.

@rmarscher
Copy link
Contributor

It turns out that the pull request I made only fixed this error message. There are other errors to get things working properly with webpack 2. I'm working through some of them. Hopefully they can all be done without breaking compatibility with webpack 1.

@rmarscher
Copy link
Contributor

I submitted a new pull request to take care of the change in webpack 2 to module.hot.apply(). I don't see anything else in process-update.js that needs to be updated.

glenjamin referenced this issue Mar 9, 2016
Handling webpack 2 promise version of module.hot.apply
@rmarscher
Copy link
Contributor

The master branch is working as designed for me. @SosZ are you able to re-test? You would need to update your package.json to have the latest version of webpack 2 and webpack-hot-middleware pulled from the master branch.

    "webpack": "^2.1.0-beta.4",
    "webpack-hot-middleware": "git+https://github.com/glenjamin/webpack-hot-middleware"

I am working on a project that doesn't use react, but it uses monkey-hot-loader instead. I had to patch monkey-hot-loader to replace named export functions and be able to parse the es2015 source. jlongster/monkey-hot-loader#5

@bayov
Copy link
Author

bayov commented Mar 9, 2016

Thank you! But I won't be able to test for a while.

@glenjamin
Copy link
Collaborator

@phaistonian would you be able to try this out and confirm its working ok?

@glenjamin
Copy link
Collaborator

I've done a bit of testing myself, looks to be working correctly on webpack 2 and webpack 1.

Will aim to release later today unless someone else spots an issue.

@phaistonian
Copy link

@glenjamin I will give it a try the soonest, though I am afraid the release will come first since I have a hectic day to deal with.

@glenjamin
Copy link
Collaborator

Released as 2.10.0

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

4 participants