Skip to content

Commit

Permalink
Inject before first script tag to avoid possible requirejs "MISMATCHE…
Browse files Browse the repository at this point in the history
…D ANONYMOUS DEFINE() MODULES" error if socket.io is injected after requirejs
  • Loading branch information
Munter committed Mar 20, 2015
1 parent 1648fe0 commit baf2d2d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lib/middleware/injectLiveStyleScriptIncludeIntoHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ module.exports = function (config) {
case 1: // <
if (ch === '/') {
state = 2;
} else if (ch === 's' || ch === 'S') {
state = 10;
} else {
state = 0;
}
Expand Down Expand Up @@ -169,6 +171,42 @@ module.exports = function (config) {
state = 0;
}
break;
case 10: // <s
if (ch === 'c' || ch === 'C') {
state = 11;
} else {
state = 0;
}
break;
case 11: // <sc
if (ch === 'r' || ch === 'R') {
state = 12;
} else {
state = 0;
}
break;
case 12: // <scr
if (ch === 'i' || ch === 'I') {
state = 13;
} else {
state = 0;
}
break;
case 13: // <scri
if (ch === 'p' || ch === 'P') {
state = 14;
} else {
state = 0;
}
break;
case 14: // <scrip
if (ch === 't' || ch === 'T') {
injectScriptAtIndex(chunk, i + 1 - '<script'.length);
return;
} else {
state = 0;
}
break;
}
}
if (!injected) {
Expand Down

0 comments on commit baf2d2d

Please sign in to comment.