-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Live reload does not work for parcel/webpack #1881
Comments
I'm not sure whether it is gitpod issue or misconfiguration of parcel. The preview listens to file changes when an opened URL is pointing to a file. In this case though the content is fetch from a server started by parcel. I would expect that parcel or webpack devserver is responsible to trigger hot reload, and it should work in the preview and in a new browser window. Could you point to docs about how to configure live reload for parcel? |
@akosyakov parcel already has preconfigured server with live reload. There are not so much room to configure it manually :(
But live reload works locally and in codesandbox (which use parcel by default) I could create minimal example with webpack if it would help. Because webpack also doesn’t work for me in gitpod |
@akosyakov I believe that I have not configured something properly on gitpod because for example |
Playground with webpack - https://github.com/maksimr/playground/tree/webpack |
Parcel tries to establish a web socket to hot reload server but fails: We expect that external URLs shoudl be consrcuted like @svenefftinge Maybe you have an idea how to deal with? Not sure about webpack yet. https://github.com/4GeeksAcademy/react-hello-webapp works for me on both ports 3000 and 8080. |
Something like parcel-bundler/parcel#2275 could help. It would be helpful if someone comments this use case on the issue. Maybe they can provide hints how to work it around. Glitch seems to use the proxy for it, but it would be nicer if it works out of the box. |
@akosyakov thanks a lot! I have created an example with webpack. I have tried to run in on PC to debug and see that requests to fetch changes failed |
Hm... in webpack examples it tries to go on port 3000 |
@alesanchezr Hi, sorry to bother. Maybe you can shed some light how you managed to enable hot reload for https://github.com/4GeeksAcademy/react-hello-webapp and what is missing in https://github.com/maksimr/playground/tree/webpack? |
It works with [email protected], but now with latest :( |
@akosyakov I was able to run live reload in latest webpack by passing |
Another solution use
|
Maybe something worthwhile to document here: https://www.gitpod.io/docs/languages-and-frameworks/ |
I have opened an issue for it on the documentation website repo https://github.com/gitpod-io/website/issues/771. Will make a Pr soon. |
@nisarhassan12 but currently parcel doesn't have proper solution due their implementation, only webpack |
@maksimr Thanks. You're right. parcel-bundler/parcel#3324 We will hopefully try to make a PR and have a proper solution implemented in Parcel soon in the future. For now, We are planning to document something like this which is a hack we used to make Live reload work for Svelte which uses Rollup as a module bundler. |
I got this working using a similar approach as the svelte patch, adding the following to the
Hope that helps someone else. FYI - this is only for parcel v1. |
Thanks, @fabrizim for sharing this. @jankeromnes is probably working on a Pr for parcel v2 once that is merged we will no longer have to hack our way around this and we will be able to do it like it's done here https://github.com/gitpod-io/sveltejs-template. The time this https://github.com/nisarhassan12/svelte/blob/7145c752efe1531d9523ff48bfad21e373d418aa/.gitpod.yml#L7 was wriiten I think there were no |
I don't know if I'm too late @jankeromnes @maksimr but here is how @unocongafas was able to fix this issue within our boilerplates: Add this into your webpack.config: const [schema, host] = process.env.GITPOD_WORKSPACE_URL.split('://')
const publicUrl = `3000-${host}`
module.exports = {
...
devServer: {
...
public: publicUrl
},
} |
Thanks, work for me |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
We just announced preview version of Gitpod local companion which allows to tunnel any tcp port: https://www.gitpod.io/blog/local-app in particular you can do http on localhost the same way as in local env, please try and give us feedback 🙏🏻 |
Example project:
https://github.com/maksimr/playground
STR:
gitpod.io/#https://github.com/maksimr/playground
npm ci
npm start
Make port public
andOpen preview
index.js
AR: Preview show old result
ER: Preview refreshed/reloaded and show new result
If manually press “Refresh” it would show new result
The same problem with webpack configuration
https://github.com/maksimr/y
OS: iPadOS 14
The text was updated successfully, but these errors were encountered: