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

Unable to build production build with relative links #5594

Closed
7 tasks done
benlesh opened this issue Nov 9, 2021 · 3 comments
Closed
7 tasks done

Unable to build production build with relative links #5594

benlesh opened this issue Nov 9, 2021 · 3 comments

Comments

@benlesh
Copy link

benlesh commented Nov 9, 2021

Describe the bug

Currently, no matter what I do, Vite builds and outputs something like:

<script  type="module" crossorigin src="/assets/index.123456.js"></script>
<link rel="modulepreload" href="/assets/vendor.123456.js">
<link rel="stylesheet" href="/assets/index.123456.css">

The problem is the environment I deploy to routes to my app, meaning the origin root is not my app's root. (e.g. https://some-origin-here/my-app is the application root), as such all links to /assets/* are pointing to the wrong thing. it would be ideal (and way more portable) if the build defaulted to relative URLs.

I'm unable to find documentation outlining how I would build and output relative URLs.

Reproduction

This seems to be true of any Vite build app.

System Info

@vitejs/plugin-react@1.0.5
vite@2.6.13

Used Package Manager

npm

Logs

No response

Validations

@benlesh
Copy link
Author

benlesh commented Nov 9, 2021

For now, as a workaround, I'm just transforming the links with a node script doing a string replace. LMAO... it's not ideal.

@stygian-desolator
Copy link
Contributor

How about base ?
It might work.

@benlesh
Copy link
Author

benlesh commented Nov 9, 2021

That's it. Thank you to you and to @yyx990803 for pointing me this way.

@benlesh benlesh closed this as completed Nov 9, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants