withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
43.84k stars 2.28k forks source link

Fix getPackage resolve path #11347

Closed bluwy closed 2 days ago

bluwy commented 2 days ago

Changes

fix https://github.com/withastro/astro/issues/11344

Refactor the way require.resolve is called. It failed before because the process.cwd() didn't have a trailing slash, so it wasn't resolve from the project directory, but its parent, which doesn't contain the node_modules to check packages for.

I refactored it to use the paths option because it's simpler and we also had a similar code like this.

https://github.com/withastro/astro/blob/dc95d674af8792773693d491a1f7520d0260e20b/packages/astro/src/core/routing/manifest/create.ts#L347

Testing

Tested manually by editing the node_modules. I wasn't testing this correctly before because I linked the package, which resolves differently.

Docs

n/a. bug fix.

changeset-bot[bot] commented 2 days ago

🦋 Changeset detected

Latest commit: dc95d674af8792773693d491a1f7520d0260e20b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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