Comments (10)
Please share the structure of your sourceCodeDir
, and the contents of config/vite.json
and vite.config.js
, and the version of vite
.
Try starting the dev server by running bin/vite dev
or npx vite
, which should output more detailed problems.
If that does not work, try deleting built assets and compile manually: bin/rake vite:clobber
and bin/vite build
, and make sure it compiles successfully.
There's an example Rails app on this repo that you can check to verify your setup (entrypoints, source code location, etc).
from vite_ruby.
I have also seen this error:
The server is configured with a public base URL of /vite-dev/ - did you mean to visit /vite-dev/application.js instead?
When visiting the URL from:
The resource at “http://localhost:3000/vite-dev/application.js” preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly.
from vite_ruby.
I am also randomly seeing this in the rails logs:
ActionController::RoutingError (No route matches [GET] "/vite-dev/@fs/Users/cj/Documents/apps/SnapNHD/snap/node_modules/.vite/debounced.js"):
ActionController::RoutingError (No route matches [GET] "/vite-dev/@fs/Users/cj/Documents/apps/SnapNHD/snap/app/assets/channels/index.js"):
from vite_ruby.
@ElMassimo here are the contents of those files https://gist.github.com/cj/e9f978c5d1c59ba0757b1ba0a5483f0d (I have also tried removing the babel plugin).
bin/vite dev
is what I use to run the server when developing.
This is what I used as an example to make sure mine was setup correctly https://github.com/ElMassimo/vite_ruby/tree/main/examples/rails
I will try and get you a standalone repo today/tomorrow, thank you again for taking a look!
from vite_ruby.
@ElMassimo here is also a full output of the rails console logs when starting up https://gist.github.com/cj/506fe28316a4216767fd56f1537de18f
from vite_ruby.
A standalone repo would be great, thanks.
I won't have computer access until Wednesday, I'll take a look then.
Looking at the traces you added, something that seems odd is that these requests are not being forwarded to Vite by the dev server proxy, can you check that it's being included in the Rack middleware? Also, which Vite version are you using?
Sidenote: The components folder should live inside your source code dir (app/assets), or make sure to add it to watchAdditionalPaths
so that changes are detected by Vite Ruby for recompilation when the dev server has not started.
from vite_ruby.
@ElMassimo so looks like I figured out a temporary fix by increasing "devServerConnectTimeout": 30
from the default 0.1
. It seems to randomly take 15+ seconds to compile sometimes, especially when loading async javascript imports. I am going to have to do some more digging to figure out why.
from vite_ruby.
The timeout should not be related with the compilation time, it's the timeout to check whether the dev server is running.
What hardware are you using, are you running in a VM or other resource-constrained environment?
@cj Make sure to add the components
folder to your config/vite.json
, otherwise changes to the components won't trigger a recompilation because they are outside your sourceCodeDir
:
{
"all": {
"watchAdditionalPaths": ["app/components/**/*"]
},
from vite_ruby.
Added a troubleshooting section describing possible causes.
Closing this for now, we can reopen it if none of the steps help, and you provide a reproduction 😃
from vite_ruby.
bin/rake vite:clobber
andbin/vite build
Running these fixed my problems
from vite_ruby.
Related Issues (20)
- Automatic refresh for SSR server HOT 1
- Some assets are randomly missing after deployment with Capistrano HOT 1
- yarn 3 Missing Executable
- How do I turn off the Inter-roman and Inter-italic fonts?
- Configurable option for location of vite.config.ts HOT 2
- Update rack-proxy to at least 0.7.5 HOT 2
- resolve_entries is slow when using vite_javascript_tag for very large and complex tsx react/relay files HOT 2
- `An import map is added after module script load was triggered` in console. HOT 4
- Fail to load styles from js files when it conflicts with stylesheet tag
- Support new default manifest location in Vite v5 HOT 9
- plugin_legacy is not working as expected
- Allow `.` as a valid option for `sourceCodeDir`
- 'conflicting chdir during another chdir block' calling vite_asset_path
- Can't find SVG file in manifest after upgrade to 3.5.0 HOT 2
- "The CJS build of Vite's Node API is deprecated." HOT 4
- Disabling cssCodeSplit breaks CSS file location used by tag helper in Rails HOT 1
- vite-rails live demo on Heroku is broken HOT 1
- clean command not detecting versions properly HOT 1
- Calling `bin/vite ssr` just exits with no errors
- vite_hanami in hanami 2.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite_ruby.