From ad139bfb630ce00ffd95b7a07c25f901bb6b5a50 Mon Sep 17 00:00:00 2001 From: PKlknr <60601481+PKlknr@users.noreply.github.com> Date: Tue, 18 Feb 2020 09:31:04 +0100 Subject: [PATCH] Log warnings in svelte/register when in dev-mode (#4365) --- register.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/register.js b/register.js index 3278c1cbf5..25f8aa4309 100644 --- a/register.js +++ b/register.js @@ -36,7 +36,15 @@ function registerExtension(extension) { format: 'cjs' }); - const { js } = compile(fs.readFileSync(filename, 'utf-8'), options); + const { js, warnings } = compile(fs.readFileSync(filename, 'utf-8'), options); + + if (options.dev) { + warnings.forEach(warning => { + console.warn(`\nSvelte Warning in ${warning.filename}:`); + console.warn(warning.message); + console.warn(warning.frame); + }) + } return module._compile(js.code, filename); };