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

pull/4429/head
PKlknr 4 years ago committed by GitHub
parent 2b3c2daafb
commit ad139bfb63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save