From f50f83c4a481da8c3e12e0502d5dc4a11c2c3fda Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 27 Oct 2018 11:41:02 -0400 Subject: [PATCH] strip leading slash from basepath - fixes #495 --- src/api/export.ts | 2 ++ test/apps/with-basepath/test.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/export.ts b/src/api/export.ts index e2f7f5d..482ba51 100644 --- a/src/api/export.ts +++ b/src/api/export.ts @@ -38,6 +38,8 @@ async function _export({ oninfo = noop, onfile = noop }: Opts = {}) { + basepath = basepath.replace(/^\//, '') + cwd = path.resolve(cwd); static_files = path.resolve(cwd, static_files); build_dir = path.resolve(cwd, build_dir); diff --git a/test/apps/with-basepath/test.ts b/test/apps/with-basepath/test.ts index f535b03..93bbcbf 100644 --- a/test/apps/with-basepath/test.ts +++ b/test/apps/with-basepath/test.ts @@ -17,7 +17,7 @@ describe('with-basepath', function() { await api.export({ cwd: __dirname, - basepath: 'custom-basepath' + basepath: '/custom-basepath' }); runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');