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

Incorrect script url when rollup output options are configured #9425

Closed
1 task done
dkobierski opened this issue Dec 13, 2023 · 1 comment
Closed
1 task done

Incorrect script url when rollup output options are configured #9425

dkobierski opened this issue Dec 13, 2023 · 1 comment
Labels
needs triage Issue needs to be triaged

Comments

@dkobierski
Copy link
Contributor

Astro Info

Astro                    v4.0.4
Node                     v20.9.0
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/vercel/serverless
Integrations             none

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

No response

Describe the Bug

Generated URLs for scripts in astro files are incorrect when using SSR and rollup output options - customizing output file names. I have checked node and vercel adapters and this issue occurs for both of them, it works in SSG though.

You can check that the generated script src here is using relative path instead of an absolute one. I've added moment package just to make the script bigger, so it goes to a separate file (smaller ones are inlined in html) - it could by anything in the script. Additionally when you configure assetsPrefix in astro options it is not added to the script path as well.

My current workaround is to make an empty Preact component and put the scripts in that file, so it's loaded as an island - islands script paths are working correctly.

What's the expected result?

The src of the script is generated properly using absolute path. When assetsPrefix is specified in the astro options it should be taken into account.

Link to Minimal Reproducible Example

https://github.com/dkobierski/astro-script-issue

Participation

  • I am willing to submit a pull request for this issue.
@ematipico
Copy link
Member

Fixed by #9437

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants