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

[🐞] Issues with SSR build when CDN is used for serving static files #7144

Open
shukklin opened this issue Dec 10, 2024 · 0 comments
Open
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working

Comments

@shukklin
Copy link

shukklin commented Dec 10, 2024

Which component is affected?

Qwik Rollup / Vite plugin

Describe the bug

The problem is that we want to place generated Qwik static files on CDN for better performance.

At the moment, Qwik does not have a built-in mechanism for this. Therefore, as a solution, we replace the file paths using the Vite configuration, but this leads to the fact that it doesn’t support absolute paths as it breaks build folder structure. And also it breaks SSR routing and navigation via hook useNavigate() as it appends CDN prefix to all routes.

Perhaps we are not using the correct way to solve this and there are better ones?

Reproduction

https://stackblitz.com/edit/github-b9xsukss

Steps to reproduce

  1. Run build with command - ASSETS_CDN_URL=https://example.com/hello/word npm run build.
  2. Check the output build directory which is located at /build path.
  3. You will see incorrect folder structure.
    Screenshot 2024-12-10 at 18 44 17
  4. And also you will see broken links in JS chunks as well (for example, q-WYzV_MAb.js).
    Screenshot 2024-12-10 at 18 47 00

System Info

  System:
    OS: macOS 15.1.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 118.08 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.6.0 - ~/.nvm/versions/node/v22.6.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v22.6.0/bin/npm
    pnpm: 8.15.4 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 131.0.6778.109
    Safari: 18.1.1

Additional Information

No response

@shukklin shukklin added STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant