-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
clarification if context
is public or private API
#656
Comments
Interesting use case, can you provide some real examples?
I was wrong, it is public API, we need to document this |
This is for a feature I work on for
Because those 2 are not interconnected right now they can run independently today and there is no need to coordinate them (we might sometimes get some unnecessary webpack recompilations, but right now they are at most "wasteful" and not breaking). Feature I work on can be described as "data-driven code-splitting" and gist of it is that data can decide which stuff gets bundled (some information in gatsbyjs/gatsby#18689 ). The problem I'm facing now is that this feature introduce interdependencies between previously 2 isolated systems. If just gatsby internals were able to trigger changes that cause webpack recompilation I would be fine - but because user can invalidate (as in edit some frontend code) while other work is happening we could emit hot-update in rather unfortunate timing leaving user with temporarily weird/broken/inconsistent state (it will fix itself eventually on its own - but "damage" can be done already in browser, causing runtime errors there etc, providing just subpar DX). So idea here is to suspend/pause webpack when there is other work happening and resume when "idle" which should result in emitting updates at time points when we know everything else is processed which should (in my head at least right now) prevent broken states in browser. |
This issue is already resolved? |
Yes this whas been documented now and part of @types packaging so this is great! |
Resolved |
Documentation Is:
Please Explain in Detail...
When creating instance of middleware it provide object with methods that are documented as public API (like
waitUntilValid
,invalidate
,close
), but also it containscontext
which is not documented. It is used in "express-style" middleware internally, so it might be considered private API (or might be just not documented API that can be used publicly).Your Proposal for Changes
Either explicitly clarify that
context
is considered private API and should not be relied on or addcontext
related APIs to README (and potentially to@types/webpack-dev-middleware
, but that's probably outside of the scope of this repo)My motivation behind request for clarification:
In my proof of concept code I'm reaching to
webpackDevMiddlewareInstance.context.watching
to be able to suspend/resume webpack watching to control when webpack is "allowed" to recompile, but I'm not sure if I'm using private API (which can change any time) or not.The text was updated successfully, but these errors were encountered: