Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward package exports warning to onwarn #192

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,15 @@ module.exports = function (options = {}) {
*/
generateBundle() {
if (pkg_export_errors.size > 0) {
console.warn(`\n${PREFIX} The following packages did not export their \`package.json\` file so we could not check the "svelte" field. If you had difficulties importing svelte components from a package, then please contact the author and ask them to export the package.json file.\n`);
console.warn(Array.from(pkg_export_errors, s => `- ${s}`).join('\n') + '\n');
const pkg_warning = `\n${PREFIX} The following packages did not export their \`package.json\` file so we could not check the "svelte" field. If you had difficulties importing svelte components from a package, then please contact the author and ask them to export the package.json file.\n`;
const pkg_exports = Array.from(pkg_export_errors, s => `- ${s}`).join('\n') + '\n';
const warning = pkg_warning + '\n' + pkg_exports;

if (onwarn) {
onwarn(warning, this.warn);
} else {
console.warn(warning);
}
}
}
};
Expand Down