strapi icon indicating copy to clipboard operation
strapi copied to clipboard

Ghostery firefox-plugin breaks strapi when using the --watch-admin flag

Open GeertJohan opened this issue 2 years ago • 0 comments

  • Node.js version: 16.16.0
  • NPM version: 8.11.0
  • Strapi version: 4.3.0
  • Database: sqlite
  • Operating system: linux
  • Firefox 103.0 w/ Ghostery 8.7.6 (12 juli 2022)

Starting strapi using yarn develop --watch-admin. Navigating to localhost:8000 gives me the login page. After logging in with valid credentials I am redirected to http://localhost:8000/admin/, which after a second shows the following screen filling the complete window. Closing the screen using the × button at the bottom of the screen results in a white page.

chunkloaderror

Uncaught ChunkLoadError: Loading chunk vendors-node_modules_strapi_icons_CodeSquare_js-node_modules_strapi_icons_Discord_js-node_mod-54c53b failed. (missing: http://localhost:8000/admin/vendors-node_modules_strapi_icon…ode_modules_strapi_icons_Discord_js-node_mod-54c53b.chunk.js)

The mentioned .chunk.js file is actually being served by strapi at localhost:8000, I can load it perfectly fine when I navigate to the URL directly. However, in the javascript console the following error has appeared just before the ChunkLoadError:

Uncaught SyntaxError: missing } after property list vendors-node_modules_strapi_icons_CodeSquare_js-node_modules_strapi_icons_Discord_js-node_mod-54c53b.chunk.js:1:55note: { opened at line 1, column 6vendors-node_modules_strapi_icons_CodeSquare_js-node_modules_strapi_icons_Discord_js-node_mod-54c53b.chunk.js:1:6

When I trust localhost:8000 in the Ghostery plugin in my browser, this error goes away and the admin panel appears. What is interesting though is that when using yarn develop without --watch-admin, the admin panel works right away, even with Ghostery enabled.

I'm not sure if this is something that strapi should or even could improve, but the difference in behaviour with/without --watch-admin is unexpected. It took me a while to figure this out so wanted to report it as it may help people encountering the same issue. But ofcourse feel free to close this issue if fixing this is not Strapi's responsibility.

GeertJohan avatar Aug 02 '22 13:08 GeertJohan

We had a similar report from another user who had an add blocker that would cause problems also.

I think in a case like this, there probably isn't much we can do here and the use-case is pretty low since the admin watching side is for things like plugin development. The best I can suggest is whitelisting the localhost:8000 (which is what I've done for ublock origin).

Most likely it's how these extensions inject themselves into the website code pulled from the server and try to require their scripts be loaded first is triggering some weird interoperability. As mentioned I'll set this one as closed for now but thank you for reporting it. We can probably add a warning for the --watch-admin command that some ad-blockers won't work with it.

derrickmehaffy avatar Aug 12 '22 21:08 derrickmehaffy