Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fix livereload on second try #1103

Merged
merged 3 commits into from
Nov 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions v1/lib/server/liveReloadServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ const gaze = require('gaze');
const tinylr = require('tiny-lr');
const readMetadata = require('./readMetadata.js');

let reloadScriptUrl;

function start(port) {
process.env.NODE_ENV = 'development';
process.env.LIVERELOAD_PORT = port;
const server = tinylr();
server.listen(port, () => {
console.log('LiveReload server started on port %d', port);
Expand All @@ -26,11 +25,12 @@ function start(port) {
});
},
);

reloadScriptUrl = `http://localhost:${port}/livereload.js`;
}

const getReloadScriptUrl = () => reloadScriptUrl;
const getReloadScriptUrl = () => {
const port = process.env.LIVERELOAD_PORT;
return `http://localhost:${port}/livereload.js`;
};

module.exports = {
start,
Expand Down