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

vite.config.ts base: './' not applied #457

Open
tomer-zadara opened this issue Apr 30, 2024 · 0 comments
Open

vite.config.ts base: './' not applied #457

tomer-zadara opened this issue Apr 30, 2024 · 0 comments
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified

Comments

@tomer-zadara
Copy link

tomer-zadara commented Apr 30, 2024

  • [V] I have tried upgrading by running bundle update vite_ruby.
  • [V] I have read the troubleshooting section before opening an issue.

Description 📖

My ruby on rails with vite application, has GUI that can be launched from root URL or from within a reverse-proxy app under a relative URL.
In vite.config.ts, after setting configuration base: './', rebuilding vite and assets and restarting GUI service, assets URLs are still absolute, like vite_javascript_tag produces URLs starting with forward slash "/vite/assets/application.xxxx.js" and "/vite/assets/application.xxxx.css", and css url() files are absolute as well.
We cannot upgrade vite to version 5, because it requires nodejs 18, which requires glibc 2.28, which requires us to upgrade from ubuntu 18.04 to 20.

Reproduction 🐞

Vite Ruby Info

Run bin/rake vite:info and provide the output:

Running via Spring preloader in process 535
bin/vite present?: true
vite_ruby: 3.3.4
vite_rails: 3.0.17
rails: 6.1.7.4
node: v16.20.2
npm: 8.19.4
yarn: 1.22.19
pnpm: 
ruby: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]

installed packages:
Zadara-VSA-GUI@ /home/ubuntu/Zadara-VSA-GUI
├─┬ @vitejs/plugin-react-swc@3.6.0
│ └── vite@4.5.2 deduped
├─┬ @vitejs/plugin-react@4.2.1
│ └── vite@4.5.2 deduped
├─┬ vite-plugin-eslint@1.8.1
│ └── vite@4.5.2 deduped
├─┬ vite-plugin-ruby@3.2.2
│ └── vite@4.5.2 deduped
└── vite@4.5.2

@ElMassimo
GitHub source code shows the prefix_vite_asset function always precedes assets path with forward slash in development:

File.join(vite_asset_origin || '/', config.public_output_dir, path)

Also here:
const base = slash(join(assetHostWithProtocol || config.base || '/', config.publicOutputDir, '/'))

@tomer-zadara tomer-zadara added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified
Projects
None yet
Development

No branches or pull requests

1 participant