Skip to content

Commit

Permalink
Log warnings in svelte/register when in dev-mode (#4365)
Browse files Browse the repository at this point in the history
  • Loading branch information
PKlknr authored Feb 18, 2020
1 parent 2b3c2da commit ad139bf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion register.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit ad139bf

Please sign in to comment.