Handle path-based assetPrefix correctly in 'gatsby serve' command #34184
Unanswered
szimek
asked this question in
Ideas / Feature Requests
Replies: 2 comments
-
my hacky solution : make a relative symlink targeting |
Beta Was this translation helpful? Give feedback.
0 replies
-
@violy Thank you! I actually even have a command that moves all static files into this new folder, but using a link is so much simpler 🤦♂️ I was looking for an alternative, because moving files breaks a lot of stuff (e.g. incremental builds). Still, it would be great if it was supported out of the box. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When
assetPrefix
option is set to a path rather than a domain (e.g./assets/my-app
), when Gatsby builds the app it does not generate asset files inpublic/assets/my-app/
, but still inpublic/
directory. This causes a problem when usinggatsby serve
command, as asset files have/assets/my-app/
prefix, and the express server can't find them.Would it make sense to handle this case correctly by default (vs having some generic "rewrite" functionality) , i.e. add something like this to the express server used by
serve
command:? The check if
assetPrefix
is a path or domain could also be done differently, e.g. withis-url-superb
orURL
class.In production I can probably solve it with nginx configuration, e.g. (not tested)
In Next.js I can solve it with
rewrites
option, e.g.:Beta Was this translation helpful? Give feedback.
All reactions