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

Fix HMR for dynamic entries #652

Merged
merged 1 commit into from
Jan 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/build/plugins/watch-pages-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class WatchPagesPlugin {

if (compiler.hasEntry(name)) return

const entries = [hotMiddlewareClientPath, f]
const entries = [hotMiddlewareClientPath, f + '?entry']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nkzawa can I why we need to add this ?entry ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we check if it's an entry page using the value on ../loaders/hot-self-accept-loader.js https://github.com/zeit/next.js/blob/master/server/build/loaders/hot-self-accept-loader.js#L15

We do this check for #294

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nkzawa.
I didn't understand it fully. But I can see the reason :)

compiler.addEntry(entries, name)
})

Expand All @@ -66,7 +66,7 @@ export default class WatchPagesPlugin {
if (defaultPages.has(name)) {
compiler.addEntry([
hotMiddlewareClientPath,
defaultPages.get(name)
defaultPages.get(name) + '?entry'
], name)
}
})
Expand Down