From 3d854317a735ffc2537881cd52b0bd10c1e75db4 Mon Sep 17 00:00:00 2001 From: Bassam Ismail Date: Thu, 25 Jun 2020 06:13:03 +0530 Subject: [PATCH] site: check if mapbox key is set before generating the production build (#5057) --- site/rollup.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/site/rollup.config.js b/site/rollup.config.js index 9cb963a87d..d4efb4eb29 100644 --- a/site/rollup.config.js +++ b/site/rollup.config.js @@ -13,6 +13,10 @@ const mode = process.env.NODE_ENV; const dev = mode === 'development'; const legacy = !!process.env.SAPPER_LEGACY_BUILD; +if (!dev && !process.env.MAPBOX_ACCESS_TOKEN) { + throw new Error('MAPBOX_ACCESS_TOKEN is missing. Please add the token in the .env file before generating the production build.'); +} + const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning); const dedupe = importee => importee === 'svelte' || importee.startsWith('svelte/');