Skip to content

Commit

Permalink
Log warnings in svelte/register when in dev-mode (sveltejs#4364)
Browse files Browse the repository at this point in the history
  • Loading branch information
PKlknr committed Feb 4, 2020
1 parent 3cbe38c commit 3478568
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion register.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ 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.log(`\nSvelte Warning in ${warning.filename}:`);
console.log(warning.message);
console.log(warning.frame);
})
}


return module._compile(js.code, filename);
};
Expand Down

0 comments on commit 3478568

Please sign in to comment.