Skip to content

Commit 45a9f0d

Browse files
author
Kurt Harriger
committed
Function name cannot contain -
When output.library contains a - the generated function name is not valid. Replace - with _ to create valid function name.
1 parent 4810ac7 commit 45a9f0d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/JsonpHotUpdateChunkTemplatePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = JsonpHotUpdateChunkTemplatePlugin;
1010

1111
JsonpHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTemplate) {
1212
hotUpdateChunkTemplate.plugin("render", function(modulesSource, modules, hash, id) {
13-
var jsonpFunction = this.outputOptions.hotUpdateFunction || ("webpackHotUpdate" + (this.outputOptions.library || ""));
13+
var jsonpFunction = this.outputOptions.hotUpdateFunction || ("webpackHotUpdate" + (this.outputOptions.library || "").replace('-','_'));
1414
var source = new ConcatSource();
1515
source.add(jsonpFunction + "(" + JSON.stringify(id) + ",");
1616
source.add(modulesSource);

lib/JsonpMainTemplatePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
114114
mainTemplate.plugin("hot-bootstrap", function(source, chunk, hash) {
115115
var hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename;
116116
var hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename;
117-
var hotUpdateFunction = this.outputOptions.hotUpdateFunction || ("webpackHotUpdate" + (this.outputOptions.library || ""));
117+
var hotUpdateFunction = this.outputOptions.hotUpdateFunction || ("webpackHotUpdate" + (this.outputOptions.library || "").replace('-','_'));
118118
var currentHotUpdateChunkFilename = JSON.stringify(hotUpdateChunkFilename)
119119
.replace(Template.REGEXP_HASH, "\" + " + this.renderCurrentHashCode(hash) + " + \"")
120120
.replace(Template.REGEXP_ID, "\" + chunkId + \"");

0 commit comments

Comments
 (0)