Skip to content

[🐞] V1 build.assetsDir causes public files to not work #8151

@intellix

Description

@intellix

Which component is affected?

Qwik City (routing)

Describe the bug

We're sharing a domain with our old angular app and the new qwik one and setting build.assetsDIr to "q" allows us to whitelist an entire directory in the load balancer to go to qwik to serve it.

With this set, I'm noticing that various files within our public directory aren't being handled as a static file, like robots.txt or manifest.json. A quick fix could be to move manifest.json into /q/ post build but Google expects robots.txt to be served from the root, so I need to fix it.

After building and serving our node entrypoint, I'm noticing that there's a isStaticFile check, which has a generated array of staticFiles that were detected during build. These have doubled up /q/q/ paths but everything still works because of the cheap /q/build check beforehand. Example:

Image

I've looked around and it seems that the pathname is being prefixed with assetsDir here: https://github.com/QwikDev/qwik/blame/38429a16069f5cf03986cb82f636d78680fdf389/packages/qwik-city/src/adapters/shared/vite/index.ts#L172

Removing this prefixing of assetDir seems to fix it for us, proof (with the assetsDir correctly added to the build JS files):

Image

The git blame says this was added by @gioboa via #6588 1 year ago.

Removing this prefixing of assetsDir works both with/without a build.assetsDir being set for me but I don't want to regress whatever it was added for. Can you confirm that removing that line is ok @gioboa? I'll do a PR and patch it locally so I can move forward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions