Roots Discourse

Browsersync page refresh loop

My config file:

{
  "entry": {
    "main": [
      "./scripts/main.js",
      "./styles/main.scss"
    ],
    "customizer": [
      "./scripts/customizer.js"
    ]
  },
  "publicPath": "/wp-content/themes/cars",
  "devUrl": "http://cars.info",
  "proxyUrl": "http://localhost:3000",
  "cacheBusting": "[name]_[hash:8]",
  "watch": [
    "app/**/*.php",
    "config/**/*.php",
    "resources/views/**/*.php"
  ]
}

after yarn start my localhost:3000 refreshes instantly… What I do wrong?
all path are ok
and everything was ok, before I installed some npm-libs

1 Like

Are you devUrl and canonical URL for WordPress the same?

Also, using a .info TLD for a development site is most likely not a good idea. I would recommend switch it to .test or .localhost as they are reserved for purposes like development.

yes, there are
I can access my webpage by this domain

Is this your development URL? Is the site being served by a local web server like MAMP or something similar? Sage’s development process only works for a development site served locally. (Reread the original post, sorry.)

If you delete your node_modules and rerun yarn && yarn start does it work? Or if you remove those packages you installed does it work?

Also, are there any error messages that Webpack is displaying?


If none of that works, In resources/assets/build/webpack.config.watch.js, temporarily add the following so we can get some useful debugging output:

    new BrowserSyncPlugin({
      target,
      open: config.open,
      proxyUrl: config.proxyUrl,
      watch: config.watch,
      delay: 500,
+     advanced: {
+       browserSync: {
+         logLevel: 'debug',
+       },
+     },
    }),

Once you’ve added that, run yarn start and report on or dump the output here.

no… removing dependencies, later removing whole node_modules and yarn - doesn’t help

also: here is output http://prntscr.com/jvadmk

Am having the same issue as well. Is there a fix?

@kotmatpockuh First, make sure there is no other processes running on port 3000 with sudo fkill :3000 then run yarn start again. If it keeps refreshing, open chrome developers tools and right click on the browser site reload button then click empty cache with force refresh. Should be good.

1 Like

The same happening to me sometimes. I just stop and rerun yarn start and it’s ok again.

Similar as when a new image is added to /images folder, everything goes to hell, then rerunning yarn does the job.

I having the same issue as well. Stopping and restarting clears out the issue, but would be great to find a solution to make the watch script work as expected.

I get exactly the same problem, using windows 10 with lando.

I just get endless browser reloads! No idea why.

My BrowserSync config is:

    {
      "entry": {
        "main": [
          "./scripts/main.js",
          "./styles/main.scss"
        ],
        "customizer": [
          "./scripts/customizer.js"
        ]
      },
      "publicPath": "/app/themes/sage",
      "devUrl": "http://bedrock.test",
      "proxyUrl": "http://localhost:3000",
      "cacheBusting": "[name]_[hash:8]",
      "watch": [
        "app/**/*.php",
        "config/**/*.php",
        "resources/views/**/*.php"
      ],
      "watchOptions": {
        "aggregateTimeout": 300,
        "poll": true
      }
    }

I’ve got a Lando setup on windows and I proxy port 3000 into my tooling container running BrowserSync.

My project runs on the following layout

/web/app/themes/sage

And My hosts file points bedrock.test at the localhost.

I got the endless reload loop! Please somebody help! I’ve added debug lines to the BS config and its output just repeatedly says:

[Browsersync] Browser Connected: Chrome, version: 74.0.3729.169
[BS] [HTML Injector] Stashing:

I’m totally stuck with this!

I would advise against using Lando or Docker for serious development with Sage. Docker isn’t great in development because it’s so slow at syncing files with the host (sometimes it completely stalls out). There are methods of keeping the node_modules (and the generated assets) on the container, but I don’t have any good examples on hand for that. Hopefully in the future we can update the Lando guide + provide solutions for using Sage in Docker environments.

Suddenly running into the same issue. Except yarn start works perfectly, and keeps working fine as we make scss changes. But if we make any scss changes and kill yarn then rerun yarn start it loads infinitely. We can’t delete or add any scss lines and have it continue working, it’s like it hates everything besides the state the scss was in at the last commit…