From a7463e7a18585e4b6bf17eff50365a91773eb30a Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 16 Feb 2023 21:22:51 +0100 Subject: [PATCH] dedent --- index.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index 5a21533..2bd1d13 100644 --- a/index.js +++ b/index.js @@ -87,27 +87,27 @@ module.exports = function (options = {}) { } } - if (pkg) { - // resolve pkg.svelte first for backwards compatibility - // we should resolve it after exports longer-term - if (entry === '.' && pkg.svelte) { - return path.resolve(dir, pkg.svelte); - } + if (!pkg) return; + + // resolve pkg.svelte first for backwards compatibility + // we should resolve it after exports longer-term + if (entry === '.' && pkg.svelte) { + return path.resolve(dir, pkg.svelte); + } - const resolved = await this.resolve(importee, importer, { skipSelf: true }); + const resolved = await this.resolve(importee, importer, { skipSelf: true }); - // if we can't resolve this import without the `svelte` condition, warn the user - if (!resolved) { - try { - resolve(pkg, entry, { conditions: ['svelte'] }); + // if we can't resolve this import without the `svelte` condition, warn the user + if (!resolved) { + try { + resolve(pkg, entry, { conditions: ['svelte'] }); - if (!warned) { - console.error('\n\u001B[1m\u001B[31mWARNING: Your @rollup/plugin-node-resolve configuration\'s \'exportConditions\' array should include \'svelte\'. See https://github.com/sveltejs/rollup-plugin-svelte#svelte-exports-condition for more information\u001B[39m\u001B[22m\n'); - warned = true; - } - } catch (e) { - // do nothing, this isn't a Svelte library + if (!warned) { + console.error('\n\u001B[1m\u001B[31mWARNING: Your @rollup/plugin-node-resolve configuration\'s \'exportConditions\' array should include \'svelte\'. See https://github.com/sveltejs/rollup-plugin-svelte#svelte-exports-condition for more information\u001B[39m\u001B[22m\n'); + warned = true; } + } catch (e) { + // do nothing, this isn't a Svelte library } } },