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

make the webpack hot module reloader work with a publicPath set #744

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion template/build/dev-client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
require('eventsource-polyfill')
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
var hotClient = require('webpack-hot-middleware/client?dynamicPublicPath=true&path=__webpack_hmr&noInfo=true&reload=true')

hotClient.subscribe(function (event) {
if (event.action === 'reload') {
Expand Down
12 changes: 9 additions & 3 deletions template/build/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ var devMiddleware = require('webpack-dev-middleware')(compiler, {
})

var hotMiddleware = require('webpack-hot-middleware')(compiler, {
log: () => {}
log: () => {},
path: path.join(webpackConfig.output.publicPath, "__webpack_hmr")
})
// force page reload when html-webpack-plugin template changes
compiler.plugin('compilation', function (compilation) {
Expand All @@ -51,7 +52,12 @@ Object.keys(proxyTable).forEach(function (context) {
})

// handle fallback for HTML5 history API
app.use(require('connect-history-api-fallback')())
app.use(
require('connect-history-api-fallback')({
index: config.dev.assetsPublicPath + 'index.html'
})
);


// serve webpack bundle output
app.use(devMiddleware)
Expand All @@ -64,7 +70,7 @@ app.use(hotMiddleware)
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
app.use(staticPath, express.static('./static'))

var uri = 'http://localhost:' + port
var uri = 'http://localhost:' + port + webpackConfig.output.publicPath

var _resolve
var readyPromise = new Promise(resolve => {
Expand Down