ensure dev client is not imported if server imports client.js

This commit is contained in:
Rich Harris
2018-10-01 12:13:03 -04:00
parent 278be67228
commit 6a74097b0c

View File

@@ -127,9 +127,11 @@ function generate_client(
footer = `
import(${stringify(sapper_dev_client)}).then(client => {
client.connect(${dev_port});
});`.replace(/^\t{3}/gm, '');
if (typeof window !== 'undefined') {
import(${stringify(sapper_dev_client)}).then(client => {
client.connect(${dev_port});
});
}`.replace(/^\t{3}/gm, '');
}
return `// This file is generated by Sapper — do not edit it!\n` + template