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

pull/4365/head
pk 6 years ago
parent 3cbe38cbf1
commit 3478568069

@ -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);
};

Loading…
Cancel
Save