-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
HMR plugin insertion for hot option and inline entry insertion in Server #1738
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1738 +/- ##
==========================================
+ Coverage 86.13% 86.85% +0.71%
==========================================
Files 8 9 +1
Lines 541 578 +37
Branches 162 170 +8
==========================================
+ Hits 466 502 +36
- Misses 62 63 +1
Partials 13 13
Continue to review full report at Codecov.
|
…g to next puppeteer test
Hmm I can't figure out why it's failing on OSX in Travis CI. Seems to be something to do with chromium writing files as a result of my new Hot tests. |
lib/utils/addEntries.js
Outdated
// make sure that we do not add duplicates. | ||
const entriesClone = entries.slice(0); | ||
[].concat(entry).forEach((newEntry) => { | ||
if (entriesClone.indexOf(newEntry) === -1) { |
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.
nit
- if (entriesClone.indexOf(newEntry) === -1) {
+ if (!entriesClone.includes(newEntry)) {
Sorry, but I will check again later as I don't have enough time to check this pr. (a little busy) |
libuv is occurring errors on CI.
|
…e jest could be detecting open handles
Not sure how to solve the libuv CI problem, any suggestions? I was changing around various other tests because I suspect what I did is making two changes in behavior with existing tests:
I can go back later and squash these random commits if you want. Edit: I thought that adding |
lib/Server.js
Outdated
} | ||
}); | ||
} | ||
} |
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 think better create helper/util for this and move this code from Server
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.
@evilebottnawi moved to utils/updateCompiler.js
…it for compilation and not use inline
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.
Looks great /cc @hiroppy
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.
thanks!
It changed the order of my entries. {
entry: {
index: ['src/polyfill.js', '(webpack)-dev-server/client?http://0.0.0.0:8081', '(webpack)/hot/only-dev-server.js', './index.tsx']
}
} My environment requires Polyfill to be run first, But after {
entry: {
index: ['(webpack)-dev-server/client?http://0.0.0.0:8081', '(webpack)/hot/only-dev-server.js', 'src/polyfill.js', './index.tsx']
}
} |
I believe this PR has broken our use of the dev-server. When trying to view the site we now get the following error, which prevents the site from loading:
I believe this issue stems from the HMR entries that have been added, however I'm not entirely sure why the port is duplicated in that URL. This error doesn't exist in [email protected]. devServerConfig looks something like this:
Has anyone faced a similar issue or have any idea what the problem might be? |
|
apologies, [company] is just me redacting the url. The real URL does not contain brackets. The non-redacted URL worked fine before 3.3.0 as explained before. |
Please open new issue with reproducible test repo |
For Bugs and Features; did you add new tests?
Yes, added Hot.test.js to test addition of the HMR plugin using the Server API, added new test in Entry.test.js to check that it prevents duplicate entries on successive calls.
Motivation / Use-Case
Fixes: #1703
It uses the compiler provided to the server to add inline entries (if they don't exist already) and to apply the HMR plugin to the compiler when the hot option is provided.
Edit: also relates to #616. I think it is impossible to avoid mutating the webpack config for this problem. It might be nice to add a feature where you can pass the webpack config into the Server, and then the Server itself creates the compiler.
Breaking Changes
None
Additional Info
It uses some slightly internal compiler functionality like compiler.options. I think it is all safe to use though.