ElMassimo / ElMassimo/vite_ruby

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

Open
#457 0 comments 0 reactions 0 assignees View on GitHub
bug: pending triage
Dominant language
Ruby
Stars
1.6k
Forks
149
Avg merge
5h 13m
Merged PRs (30d)
2

Description

[troubleshooting section]: https://vite-ruby.netlify.app/guide/troubleshooting.html

- [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:
https://github.com/ElMassimo/vite_ruby/blob/c726a1618e2e0658322d1a201759d3447beaa096/vite_ruby/lib/vite_ruby/manifest.rb#L137
Also here: https://github.com/ElMassimo/vite_ruby/blob/981d69de48a018d7fd42612557ec00572f8ef1fa/vite-plugin-ruby/src/config.ts#L104

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.