mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-24 08:17:29 +01:00
Log warnings in svelte/register when in dev-mode (#4365)
This commit is contained in:
parent
2b3c2daafb
commit
ad139bfb63
10
register.js
10
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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user