-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
The addon is not working properly even with basic projects based on the HTTP protocol #19
Comments
It looks like you're expecting browsersync to be looking at files that are not listed in the config file, see Why don't you try adjusting that so it looks at what you're interested in and see how it goes? I haven't seen a Please remember that this is an open-source project, and community involvement is requested. Maybe you'd like to do a PR that improves the README by suggesting that people add more directories to the browsersync.js file. |
Thank you for your reply. Here it is not about the Regarding line 12, I made the following change, taking into account that index.htm is in the root. files: ["index.htm", "/index.htm"], Am I doing something wrong? |
Since the tests are passing and this is in use by lots of people I imagine you're doing something wrong. I don't think you can use a "/index.html", which would probably mean something entirely different. I would think that just
would be all you'd need if you only want to watch index.htm. If you want to watch other files or directories, add them. But not with a leading I'll leave you now and I'm sure the maintainer @tyler36 will have something to say, as he uses this often. |
In that array important is to match a condition. I did it before leaving only |
I tried following your steps but was unable to reproduce the problem. Example
It works out-of-the-box. |
I also have a demo project at https://github.com/tyler36/browsersync-demo based on Laravel. ddev browsersync
...
External: http://browsersync-demo.ddev.site:3000
So it seems to work on HTTPS too (I should probably update the README) |
Thank you for your reply. I will check again this time using Ubuntu Desktop latest. Could you please let me know what OS did you use in your testing? |
Thanks for the update @ADDISON74 I'm using: DDEV: 1.21.1 I don't have browsersync installed locally so everything is running inside the DDEV containers. |
I created a VM in which I installed Ubuntu latest, then I installed Docker, DDEV and followed your steps. I confirm that it works without issues, but we must take into account that the DDEV project is accessible through the HTTP protocol. See bellow a screenshot: I will configure DDEV to open the project using the HTTPS protocol. If it works this time too, it means that the issue is with the packages used in Windows. I didn't use installed globally browser-sync. |
In your original post, "Steps to reproduce this", step 2 says |
The initial post contains two testing versions: one in which I show that Browser-Sync works if it is installed globally, the other in which I only use the ddev-browsersync addon. I checked a few moments ago and the issue report is not with the globally installed browser-sync package. At this moment the package is removed but the issue remains. |
I installed in Ubuntu the mkcert package to check how this addon works with the HTTPS protocol. DDEV automatically detects the existence of certificates and the project can be accessed at 1 - If I access 2 - If I change the protocol in the URL to 3 - If I switch back the URL to https://browsersync1.ddev.site it doesn't work. In conclusion, this addon works only on the HTTP protocol, which is correctly mention in its README. For HTTPS protocol some changes are needed, the project URL should be the same with browsersync. Unfortunately what I got in Ubuntu I didn't get in Windows 10 Pro based on the same configuration. I will test again in a VM (Windows 10 Pro + Docker + DDEV). |
@ADDISON74 I have a PR (#21) which should fix it. Please let me know if this resolves the issue. |
OS: Windows 10 Pro
Docker: 20.10.17
DDEV: 1.21.1
Browser-Sync: 2.27.10
Steps to reproduce this issue:
1 - Create a directory named test2 and create one file inside named index.htm (a boilerplate with some text).
2 - Install globally browser-sync with the following command
npm install -g browser-sync
3 - Open a Terminal in the current directory and run
browser-sync start --server --files "*"
. The browser opens loading the index.htm file.4 - Edit the index.htm file, save it and take a look at the browser window. Page reloads with the new content. In Windows PowerShell window you will see this information:
As you may see BrowserSync works fine. Let's test it with this DDEV addon.
5 - Create a new directory named test1 and copy inside what is in the test2 directory (index.html).
6 - Run
ddev config
and choose a php for "Project Type".7 - Run
ddev get drud/ddev-browsersync
. As an personal comment this message seems to be wrong "Please file issues and create pull requests there to improve it.". It should be "Please report issues ...".8 - Run
ddev start
. Now we can reach the project at https://test1.ddev.site or https://127.0.0.1:53834. As you can see both links use HTTPS protocol.9 - Run
ddev browsersync
and you will get this information in your Terminal window:10 - Keep CTRL pressed and click on the External link. The browser opens loading the index.htm file. It is an HTTP connection.
11 - Edit the index.htm file, save it and take a look at the browser and Terminal window. NOTHING HAPPENS, the browser is not reloading and there are no new lines in Broswersync console. If we take a look in the file .ddev/browser-sync.js we will see that docroot is mentioned in the files option. As the file index.html is in the docroot, any changes in it should be found in the browser window.
Therefore, this addon does not work even with the basic configuration on a project that only has an HTML file. It is not an HTTP/HTTPS issue because in the browser window I can load the index.html page with both HTTP and HTTPS protocols. I hope based on this report to investigate and find a fix.
Also if this addon will not be updated ASAP for HTTPS proctol it is useless. In order to use it, maybe DDEV should have a question related to the desired protocol when creating the configuration file, otherwise in the case of this addon few know which files to modify to use the HTTP protocol only, the situation in which DDEV's purpose to provide a simple and fast interface with Docker is no longer valid. This can be discussed on the DDEV project page.
The text was updated successfully, but these errors were encountered: