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

fix(prefetch): Fix the inclusion of @types/network-information #7123

Merged
merged 4 commits into from
May 19, 2023

Conversation

connor-baer
Copy link
Contributor

@connor-baer connor-baer commented May 18, 2023

Changes

#7104 added the "files" field to all packages to limit the files that are published to npm. The @astro/prefetch package only includes the dist folder, however, the code tries to import from the @types folder, causing the following error:

Could not resolve "../@types/network-information.d.ts" from "node_modules/@astrojs/prefetch/dist/client.js"

I added the @types folder to the "files" field to fix it.

I changed the import to a triple-slash directive as suggested by @bluwy.

Testing

I did not test the change as it seems straightforward.

Docs

This fixes an expected behavior, so an update to the docs doesn't seem necessary.

@changeset-bot
Copy link

changeset-bot bot commented May 18, 2023

🦋 Changeset detected

Latest commit: 907990f

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label May 18, 2023
@bluwy
Copy link
Member

bluwy commented May 19, 2023

Hi, thanks for catching this. I didn't expect the types file to be imported, and it doesn't seem right that it's imported by a JS file.

I think instead we can remove the import here:

import '../@types/network-information.d.ts';

and add this to the top of the file instead.

/// <reference types="../@types/network-information.d.ts" />

@connor-baer
Copy link
Contributor Author

@bluwy That makes sense! I've changed the approach as suggested.

@connor-baer connor-baer changed the title fix(prefetch): Include @types in published files fix(prefetch): Fix the inclusion of @types/network-information May 19, 2023
@bluwy bluwy merged commit 1473737 into withastro:main May 19, 2023
12 of 13 checks passed
@astrobot-houston astrobot-houston mentioned this pull request May 19, 2023
@connor-baer connor-baer deleted the bugfix/prefetch-files branch May 19, 2023 20:12
@millette
Copy link
Contributor

millette commented May 20, 2023

Are releases automated/on a schedule? Downgrading for now.

@bluwy
Copy link
Member

bluwy commented May 20, 2023

I've cut a new release to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants