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

[Feature] index.html / dev server proxy #179

Closed
jpmaga opened this issue May 18, 2020 · 1 comment
Closed

[Feature] index.html / dev server proxy #179

jpmaga opened this issue May 18, 2020 · 1 comment

Comments

@jpmaga
Copy link

jpmaga commented May 18, 2020

Is your feature request related to a problem? Please describe.
Not really a problem, more like a limitation from what I could find in the documentation, and a stroll through the code. I might be jumping the gun a bit, but I seem to be unable to use this outside the defined structure. I don't seem to be able to run it from other places.

Example:
server on port 9000 only has an index.html file, with the script src as http://localhost:3000/something.js (vite dev server), the first error it will get is about cors. Setting it in vite.config.js doesn't work, probably some order hierarchy issue, If i go to vite's dist directory in node_modules and add it after creating the Koa app, this error goes away.

const cors = require('@koa/cors')
app.use(cors({ origin: '*' }))

Now, the second error, is that it is trying to access files under [http://localhost:9000]/index.css for example, instead of localhost:3000, also the websocket is ws://localhost:9000 instead of the proper vite's dev server: ws://localhost:3000

Describe the solution you'd like
While developing, I think there should be a way to to proxy the index.html content, as this would allow vite to be used in a lot more contexts, for example with web server serving php files, like some other tools do (webpack, browsersync, etc).

Describe alternatives you've considered
I haven't considered any. Just trying a major step up in speed from webpack.

Additional context
Personally, this request primarily comes from the fact that I have a lot of laravel projects and would be nice to be able to use vite for them.

Cheers, and congrats on the amazing job on this.

@yyx990803
Copy link
Member

Thanks - tracking in #147

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants