Vite Asset requests very slow (multiples of 60s) #354
Replies: 3 comments
-
This is another request cycle (Loading a login that doesnt use any assets served by vite and then submitting it: All requests going to the /vite-dev route seem to be slow. GET /vite-dev/pages/transferlog.jsx | 200 OK | 60.03s |
Beta Was this translation helpful? Give feedback.
-
Hi Dave! The 60s response time seems very unusual, and suggests that these requests are hitting some kind of timeout before being served. If you provide a repo with a minimal reproduction and steps to replicate it, I can take a look. Try setting |
Beta Was this translation helpful? Give feedback.
-
Hi Máximo, thanks for your response. I reckon those were some leftovers coming from setting things up with the shopify CLI and then switching over to using the vite_rails gem. Was that maybe some requests getting passed around in circles between vite and rails? Thanks again for your input. |
Beta Was this translation helpful? Give feedback.
-
Hi there,
I am using the vite-rails gem to run my rails server with vite. I am using ngrok to tunnel the requests to my server.
(already tried another tunneling service (cloudflared), same result)
The initial request to the root url is fast but then the requests to the javascript assets are served very slow (Multiples of 60s as can be seen in the ngrok log).
Any Idea what might be the issue here? I am not using tailwind.css (as discussed here: vitejs/vite#5145)
It's working fine when using the vite proxy and pointing the ngrok tunnel to port 3036, but that is breaking other things.
I am on Windows 11. It is also working for a colleage who is working on Linux.
This is my vite.config.ts:
import { defineConfig } from 'vite';
import ViteRails from 'vite-plugin-rails';
import react from "@vitejs/plugin-react";
const proxyOptions = {
target:
http://127.0.0.1:3000
,changeOrigin: false,
secure: true,
ws: false,
};
export default defineConfig({
server: {
host: 'localhost',
hmr: {
host: 'localhost',
port: 3036,
protocol: 'ws'
},
proxy: {
"^/(\?.)?$": proxyOptions,
"^/api(/|(\?.)?$)": proxyOptions,
},
},
plugins: [
ViteRails({
envVars: {
'CABLE_ENDPOINT': null,
'SHOPIFY_CLIENT_API_KEY': null,
}
}),
react(),
]
})
This is my vite.json:
{
"all": {
"sourceCodeDir": "frontend",
"watchAdditionalPaths": []
},
"development": {
"autoBuild": true,
"publicOutputDir": "vite-dev",
"port": 3036
},
"test": {
"autoBuild": true,
"publicOutputDir": "vite-test",
"port": 3037
}
}
This is my output from ngrok:
GET /vite-dev/pages/ExitIframe.jsx
200 OK 240.2s
GET /vite-dev/pages/NotFound.jsx
200 OK 240.19s
GET /vite-dev/pages/index.jsx
200 OK 180.14s
GET /vite-dev/pages/Import.jsx
200 OK 240.21s
GET /vite-dev/node_modules/.vite/deps/react_jsx-dev-runtime.js
200 OK 180.13s
GET /vite-dev/node_modules/.vite/deps/chunk-DFKQJ226.js
200 OK 180.13s
GET /vite-dev/node_modules/.vite/deps/chunk-DHVF7XXF.js
200 OK 60.02s
GET /vite-dev/node_modules/.vite/deps/chunk-GDXK6ZMY.js
200 OK 60.02s
GET /vite-dev/@fs/C:/Workspace/lexoffice-integration/node_modules/vite/dist/client/env.mjs
200 OK 180.13s
GET /vite-dev/@id/__x00__react/jsx-dev-runtime
200 OK 180.12s
GET /vite-dev/App.jsx
200 OK 180.12s
GET /vite-dev/node_modules/.vite/deps/react-dom.js
200 OK 120.07s
GET /vite-dev/node_modules/.vite/deps/react.js
200 OK 120.08s
GET /vite-dev/@fs/C:/Workspace/lexoffice-integration/node_modules/vite/dist/client/env.mjs
200 OK 120.07s
GET /vite-dev/App.jsx
200 OK 60.03s
GET /vite-dev/node_modules/.vite/deps/react-dom.js
200 OK 60.03s
GET /vite-dev/node_modules/.vite/deps/react.js
200 OK 60.02s
GET /vite-dev/@id/__x00__react/jsx-dev-runtime
200 OK 60.02s
GET /vite-dev/@react-refresh
200 OK 120.02s
GET /vite-dev/@react-refresh
200 OK 60.06s
GET /vite-dev/entrypoints/index.jsx
200 OK 60.07s
GET /vite-dev/@vite/client
200 OK 60.1s
GET /vite-dev/entrypoints/index.jsx
200 OK 60.18s
GET /vite-dev/@vite/client
200 OK 60.19s
GET /
200 OK 718.11ms
GET /
200 OK 1.15s
This is my ngrok tunnel config:
authtoken: ***
region: eu
update: true
tunnels:
lexoffice:
proto: http
addr: 3000
subdomain: lexoffice-shopify
version: "2"
Any input is much appreciated.
Best, Dave
Beta Was this translation helpful? Give feedback.
All reactions