Using the whole roots setup with Trellis, Bedrock and Sage I face the following issue while using WordPress Multisite with subdomains:
I set up a subsite with the subdomain sub.example.test
and activated a specific sage theme for it. The config.json is as this:
{
"entry": {
"add-to-cart-variation": [
"./scripts/util/add-to-cart-variation.js"
],
"main": [
"./scripts/main.js",
"./styles/main.scss"
],
"customizer": [
"./scripts/customizer.js"
]
},
"publicPath": "/app/themes/corporate",
"devUrl": "http://sub.example.test",
"proxyUrl": "http://localhost:3000",
"cacheBusting": "[name]_[hash:8]",
"watch": [
"app/**/*.php",
"config/**/*.php",
"resources/views/**/*.php"
]
}
Please note the "devUrl": "http://sub.example.test",
used with the subdomain.
Webpack is working just fine in this set-up as it is updating the styles directly. But as soon as I start to edit a JS file Webpack continues updating the localhost:3000
browser every sec.
The following is returned in the console after very page load:
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (main.css, line 0)
[Log] JQMIGRATE: Migrate is installed with logging active, version 1.4.1 (jquery-migrate.js, line 23)
[Warning] Ignored an update to unaccepted module 23 -> 20 -> 19 (main.js, line 2205)
[Warning] [HMR] The following modules couldn't be hot updated: (Full reload needed) (main.js, line 2278)
This is usually because the modules which have changed (and their parents) do not know how to hot reload themselves. See https://webpack.js.org/concepts/hot-module-replacement/ for more details.
[Warning] [HMR] - ./resources/assets/scripts/routes/common.js (main.js, line 2286)
[Warning] [HMR] Reloading page (main.js, line 2325)
I double checked the config above as mentioned in some topics in the forum here but Iām quite sure that everything is correct. ALSO if I activate the same theme on the main site at examples.test
and do the JS edits there, the browser refreshes just once (as expected).
Another reason could be that I sometimes get the error Did not load script at 'http://example.test/app/themes/corporate/dist/scripts/main.js' because non script MIME types are not allowed when 'X-Content-Type: nosniff' is given.
on the subdomain.
So after all those observations Iām quite lost as Iām not sure where the issue is.
Maybe someone has a useful idea or solution.
Thanks and best regards,
Philipp