From 6a74097b0c5777ef1f0fa0688ff72b61eb2ac763 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 1 Oct 2018 12:13:03 -0400 Subject: [PATCH] ensure dev client is not imported if server imports client.js --- src/core/create_manifests.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/create_manifests.ts b/src/core/create_manifests.ts index 1e1a09a..a71ae52 100644 --- a/src/core/create_manifests.ts +++ b/src/core/create_manifests.ts @@ -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