kit icon indicating copy to clipboard operation
kit copied to clipboard

feat: Improve external dependency handling for non-standard project structures (adapter-node)

Open Black1358 opened this issue 6 months ago • 6 comments

This PR enhances the Rollup configuration to better handle projects where package.json isn't located in the same directory (my case).


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • [x] This message body should clearly illustrate what problems it solves.
  • [x] Ideally, include a test that fails without this PR but passes with it.

Tests

  • [ ] Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • [x] Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Black1358 avatar May 16 '25 00:05 Black1358

⚠️ No Changeset found

Latest commit: d42607b0ae8682352ce4996f791b80e6cfd69fa4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar May 16 '25 00:05 changeset-bot[bot]

New features should include an explanation of why they are necessary (why does your package.json need to be located elsewhere) and documentation for the new feature. It's hard to review without this context

benmccann avatar May 16 '25 20:05 benmccann

In my specific case, I'm not just working with an one SvelteKit application, and I can't use a monorepo approach (it would add unnecessary complexity). Everything works perfectly until it gets to the build stage. The adapter fails with an error because it can't find the package.json which is located one level up. The adapter definitely shouldn't prevent us from having structure like

/app/...  
/package.json

Black1358 avatar May 16 '25 21:05 Black1358

Please open an issue with a reproduction of your problem.

Please open an issue with a reproduction of your problem.

The problem is that the adapter's code hardcodes the path to package.json when parsing dependencies. When the project has this structure:

app/...  
package.json  

the build fails with an error since it can't locate the package.json file

Black1358 avatar Jun 10 '25 21:06 Black1358

There's still not really enough information here to understand your problem. This should really include an issue with a reproduction

benmccann avatar Jun 13 '25 20:06 benmccann

Closing this as it sounds clear that a monorepo is the correct approach, and no reproduction or clarifying information was given

Rich-Harris avatar Aug 13 '25 20:08 Rich-Harris