-
-
Notifications
You must be signed in to change notification settings - Fork 2
added host option to plugin config, fixed devServer value in nette.json #2
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
base: master
Are you sure you want to change the base?
Conversation
I probably should have included a test to make sure the plugin option overrides the vite host config. Will add it later today. |
Should be ready to go. |
When I was writing the Docker Dev section in the docs, I noticed that there is a bug with the host also being set to Edit: Done, also added auto configuration of the |
Hi, thank you for your work. This works great for fixing the host issue. However I ran into a case where I’d need the generated dev server URL to omit the port (i.e. just vite.localhost instead of vite.localhost:5173). Would you consider adding a port option to the config (e.g. port: false, port: 80, port: 5173, etc.) to support that? Could be helpful for setups with reverse proxies. Thanks! |
Hi, yeah, should be an easy fix. Will look into it later when I have a bit more time. In the meantime you could add a patch to the vite plugin yourself. There is a npm package (patch-package) for these situations that allows you to modify a package until whatever feature you need is released. |
Should work now. The generated export default defineConfig({
plugins: [
nette({
host: "vite.localhost",
}),
],
server: {
host: true, // Or '0.0.0.0'
port: 80,
strictPort: true,
},
...
}); |
http://true:5173
#1This PR adds a new host option to the plugin configuration. This allows to override the vite host config when needed.
Additionally, if the host value is set to
true
or'0.0.0.0'
, it is replaced with'localhost'
, fixing incorrect urls in the generated nette.json file.While
http://0.0.0.0:5173
does work, it redirects tohttp://localhost:5173
for each asset loaded.For example:
will result in: