-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(Server): add /invalidate
endpoint
#1546
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, we need add tests for this
Here you can get all assets https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L119, maybe problem can be solved using Anyway adding |
/invalidate
endpoint
Awesome, thanks @evilebottnawi :) Happy to work on tests for this, which test files should I look at specifically? |
Great, thanks @evilebottnawi. Is there a standard expectation I can use that asserts that compilation is triggered? |
@camertron Just add your route in test, it is ensure what all works as expected |
Codecov Report
@@ Coverage Diff @@
## master #1546 +/- ##
==========================================
+ Coverage 89.19% 89.73% +0.54%
==========================================
Files 9 9
Lines 611 614 +3
Branches 186 186
==========================================
+ Hits 545 551 +6
+ Misses 54 52 -2
+ Partials 12 11 -1
Continue to review full report at Codecov.
|
@evilebottnawi added a test a few days ago. No rush, but any idea when this can be merged/released? |
@camertron can we rebase master? Also wait review from other contributors, feel free to ping if no one will do this in the next 3 days |
2866974
to
5d283cc
Compare
@evilebottnawi done :) |
@camertron hm, something wrong with travis 😕 |
lib/Server.js
Outdated
@@ -243,6 +243,11 @@ function Server (compiler, options = {}, _log) { | |||
res.end('</body></html>'); | |||
}); | |||
|
|||
app.get('/invalidate', (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need func params here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need res
, but req
can be removed. Done :)
@camertron Could you rebase? |
da14978
to
56792b7
Compare
@evilebottnawi done :) |
@camertron Could you rebase? |
@hiroppy I just tried but I no longer understand how Server.js is architected 😢 |
Currently, Routes are separated from Server.js. See https://github.com/webpack/webpack-dev-server/blob/master/lib/utils/routes.js |
@evilebottnawi I got tired of the constant requests to rebase, but I'm sad this has been closed. It could have been merged a loooong time ago, back when I originally submitted it. I'm not sure why it wasn't. |
For Bugs and Features; did you add new tests?
Sadly no. How should I go about testing this? Happy to work something up given some direction.
Motivation / Use-Case
We're trying to use docker-compose for local development of a giant monolithic rails app that uses webpack for several pages written with react. For performance reasons, we're mounting a volume inside the rails container using NFS, which doesn't support file system events. Consequently, making changes to our react components doesn't trigger an automatic webpack refresh. This PR is an attempt to expose and endpoint that, when hit, will trigger a recompile. The idea is to run a separate container with a regular 'ol non-NFS volume that will listen for file system events and ping the /invalidate endpoint. Actually, while I have you here, I've been trying to figure out an easy way to get the list of files webpack-dev-server is watching, but that appears to be pretty well concealed. Any tips?
Additional Info
I added this change by creating a branch from master, but, if this change is accepted, I would love it if it could be released as both a 2.x and a 3.x version bump, since we are still stuck on 2.x at the moment.