Skip to content

Commit

Permalink
fix: prod test failure due to minification artifcats interfering with…
Browse files Browse the repository at this point in the history
… code rewrite
  • Loading branch information
abose committed Jan 11, 2024
1 parent a0fdcd0 commit 4cb323d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@
// LivePreviewTransport.js:getRemoteScript() This is so that the actual live preview page doesnt get hold of
// any phoenix web socket or broadcast channel ids from this closure programatically for security.

const TRANSPORT_CONFIG={};
//Replace dynamic section start
//REPLACE_ME_WITH_LIVE_PREVIEW_TRANSPORT_CONFIG_AND_SCRIPT_DYNAMIC
const TRANSPORT_CONFIG={};
//Replace dynamic section end

function _debugLog(...args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ define(function (require, exports, module) {
* @return {string}
*/
function getRemoteScript() {
const replaceString = "//REPLACE_ME_WITH_LIVE_PREVIEW_TRANSPORT_CONFIG_AND_SCRIPT_DYNAMIC";
const replaceString = "const TRANSPORT_CONFIG={};";
if(!LivePreviewTransportRemote.includes(replaceString)){
throw new Error("Live preview transport is expected to have replaceable template string:" +
" //REPLACE_ME_WITH_LIVE_PREVIEW_TRANSPORT_CONFIG_AND_SCRIPT_DYNAMIC");
}
let transportScript = (_transportBridge && _transportBridge.getRemoteTransportScript &&
_transportBridge.getRemoteTransportScript()) || "";
transportScript = `TRANSPORT_CONFIG.PHOENIX_INSTANCE_ID = "${Phoenix.PHOENIX_INSTANCE_ID}";\n` +
transportScript = "const TRANSPORT_CONFIG={};" +
`TRANSPORT_CONFIG.PHOENIX_INSTANCE_ID = "${Phoenix.PHOENIX_INSTANCE_ID}";\n` +
`TRANSPORT_CONFIG.LIVE_DEV_REMOTE_WORKER_SCRIPTS_FILE_NAME = "${LiveDevProtocol.LIVE_DEV_REMOTE_WORKER_SCRIPTS_FILE_NAME}";\n` +
`TRANSPORT_CONFIG.LIVE_PREVIEW_DEBUG_ENABLED = ${logger.loggingOptions.logLivePreview};\n`+
transportScript;
Expand Down

0 comments on commit 4cb323d

Please sign in to comment.