mirror of https://github.com/webpack/webpack.git
Fix hot loader compatibility with Java8 Nashorn
The way that the hot loader is included in a bundle breaks in Java 8's Nashorn engine, because of a missing semicolon. This change introduces a placeholder value that can be correctly substituted when building a bundle, but is otherwise inert. Note that I don't particularly like this change, so if there's a better fix, I'd like to hear about it.
This commit is contained in:
parent
e8ffa362bb
commit
ebe2f371c1
|
|
@ -7,7 +7,7 @@ module.exports = function() {
|
|||
function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
||||
hotAddUpdateChunk(chunkId, moreModules);
|
||||
if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
|
||||
}
|
||||
} //$semicolon
|
||||
|
||||
function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
|
|||
return source + "\n" +
|
||||
"var parentHotUpdateCallback = this[" + JSON.stringify(hotUpdateFunction) + "];\n" +
|
||||
"this[" + JSON.stringify(hotUpdateFunction) + "] = " + Template.getFunctionContent(require("./JsonpMainTemplate.runtime.js"))
|
||||
.replace(/\/\/\$semicolon/g, ";")
|
||||
.replace(/\$require\$/g, this.requireFn)
|
||||
.replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
|
||||
.replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module.exports = function() {
|
|||
function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
||||
hotAddUpdateChunk(chunkId, moreModules);
|
||||
if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
|
||||
}
|
||||
} //$semicolon
|
||||
|
||||
function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
|
||||
importScripts($require$.p + $hotChunkFilename$);
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ WebWorkerMainTemplatePlugin.prototype.apply = function(mainTemplate) {
|
|||
return source + "\n" +
|
||||
"var parentHotUpdateCallback = this[" + JSON.stringify(hotUpdateFunction) + "];\n" +
|
||||
"this[" + JSON.stringify(hotUpdateFunction) + "] = " + Template.getFunctionContent(require("./WebWorkerMainTemplate.runtime.js"))
|
||||
.replace(/\/\/\$semicolon/g, ";")
|
||||
.replace(/\$require\$/g, this.requireFn)
|
||||
.replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
|
||||
.replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename)
|
||||
|
|
|
|||
Loading…
Reference in New Issue