-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix socket connection for non-inlined connections
- Loading branch information
Showing
1 changed file
with
4 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,13 @@ var url = require('url'); | |
var SockJS = require("sockjs-client"); | ||
var stripAnsi = require('strip-ansi'); | ||
var scriptElements = document.getElementsByTagName("script"); | ||
var scriptHost = scriptElements[scriptElements.length-1].getAttribute("src").replace(/\/[^\/]+$/, ""); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
// If this bundle is inlined, use the resource query to get the correct url. | ||
// Else, get the url from the <script> this file was called with. | ||
This comment has been minimized.
Sorry, something went wrong.
STRML
|
||
var urlParts = url.parse(typeof __resourceQuery === "string" && __resourceQuery ? | ||
__resourceQuery.substr(1) : | ||
scriptElements[scriptElements.length-1].getAttribute("src").replace(/\/[^\/]+$/, "") | ||
(scriptHost ? scriptHost : "/") | ||
); | ||
|
||
var sock = null; | ||
|
This is causing some problems in our build; you can't really assume that the webpack socket script is the last script on the page.