0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-28 07:52:41 +01:00

Log warnings in svelte/register when in dev-mode (#4365)

This commit is contained in:
PKlknr 2020-02-18 09:31:04 +01:00 committed by GitHub
parent 2b3c2daafb
commit ad139bfb63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,15 @@ function registerExtension(extension) {
format: 'cjs' 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); return module._compile(js.code, filename);
}; };