Skip to content

Commit

Permalink
[feat] warn if svelte not found in dependencies or peerDependencies (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Nov 16, 2022
1 parent e12e2fb commit 689f6d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-rocks-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/package': patch
---

[feat] warn if svelte not found in dependencies or peerDependencies
6 changes: 6 additions & 0 deletions packages/package/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export async function build(config, cwd = process.cwd()) {

const pkg = generate_pkg(cwd, files);

if (!pkg.dependencies?.svelte && !pkg.peerDependencies?.svelte) {
console.warn(
'Svelte libraries should include "svelte" in either "dependencies" or "peerDependencies".'
);
}

if (!pkg.svelte && files.some((file) => file.is_svelte)) {
// Several heuristics in Kit/vite-plugin-svelte to tell Vite to mark Svelte packages
// rely on the "svelte" property. Vite/Rollup/Webpack plugin can all deal with it.
Expand Down

0 comments on commit 689f6d0

Please sign in to comment.