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

Asset files do not load when using custom file names + node adapter #426

Open
1 task
utkarshkukreti opened this issue Oct 11, 2024 · 3 comments
Open
1 task
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) pkg: node Related to Node adapter (scope)

Comments

@utkarshkukreti
Copy link

utkarshkukreti commented Oct 11, 2024

Astro Info

Astro                    v4.16.0
Node                     v20.15.0
System                   macOS (x64)
Package Manager          pnpm
Output                   server
Adapter                  @astrojs/node
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When using custom file names in vite rollup options (as documented here) with the node adapter, some assets are moved to the server folder resulting in 404 errors on the client.

Reproduction: https://github.com/utkarshkukreti/astro-asset-file-names-bug/ (I could not get the node adapter working on stackblitz so I uploaded the repo instead.)

Build and run with: pnpm build && node dist/server/entry.mjs, open http://localhost:4321/ and you'll see the css does not load.

Diff from the astro starter template: https://github.com/utkarshkukreti/astro-asset-file-names-bug/compare/8f07d763094819d96096ceae6c601eca25cecbc8..main

Built files:

$ find dist | grep css
dist/server/assets/asset.DUCGYX_l.css

The browser requests /assets/asset.DUCGYX_l.css which returns a 404 error.

What's the expected result?

The css files should load. (They should probably be in the client/ folder not server/)

Link to Minimal Reproducible Example

https://github.com/utkarshkukreti/astro-asset-file-names-bug

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Oct 11, 2024
@florian-lefebvre florian-lefebvre removed the needs triage Issue needs to be triaged label Oct 22, 2024
@florian-lefebvre florian-lefebvre transferred this issue from withastro/astro Oct 22, 2024
@florian-lefebvre florian-lefebvre added - P3: minor bug An edge case that only affects very specific usage (priority) pkg: node Related to Node adapter (scope) labels Oct 22, 2024
@apatel369
Copy link

Looking into it

@utkarshkukreti
Copy link
Author

This has been fixed in withastro/astro#12449 and released in [email protected], thanks @apatel369!

@utkarshkukreti
Copy link
Author

Reopening due to withastro/astro#12748.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) pkg: node Related to Node adapter (scope)
Projects
None yet
Development

No branches or pull requests

3 participants